merge-1.7.0

KOSI Plugin Merge Version 1.7.0

Summary

The Merge plugin for KOSI enables the merging of XML files, allowing users to combine multiple XML sources into a single target file within a KOSI package.

The plugin supports merging a single XML file into another or merging all XML files within a specified directory into a target file. Additionally, users can create a backup of the original target file before applying the merge, ensuring data safety.

Features

  • Merges XML files: Supports merging one or multiple XML source files into a target XML file.
  • Directory merging support: Merges all XML files from a specified directory into the target file.
  • Backup creation: Optionally stores a backup of the target file before merging.

Keys

Key Required Description
file1 Yes The target XML file where the merge operation will be applied.
file2 Yes The source XML file or directory containing multiple XML files to be merged into file1.
backupPath Optional If specified, a backup of file1 will be created in this location before merging.

Notes

  • If file2 is a single file, that file will be merged into file1.
  • If file2 is a directory, all XML files within that directory will be merged into file1.
  • The plugin only supports XML files at this time. Other file formats are not supported.

Examples

Example 1 - Merging a single XML file into another

This example merges /root/config-update.xml into /root/config.xml, while keeping a backup of /root/config.xml in the /root/backup/ directory.

languageversion = "1.0.0";
apiversion = "kubernative/kubeops/sina/user/v4";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
    input = "template.yaml";
}

containers =
{
    example = ["docker.io", "nginx", "latest"];
}

install
{  
    merge
    (
      file1 = "/root/config.xml";
      file2 = "/root/config-update.xml";
      backupPath = "/root/backup/";
    );
}

Example 2 - Merging all XML files from a directory into a target file

In this case, the plugin merges all XML files located in /root/xml-updates/ into /root/main-config.xml. A backup of /root/main-config.xml is created in /root/backup/ before applying the merge.

languageversion = "1.0.0";
apiversion = "kubernative/kubeops/sina/user/v4";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
    input = "template.yaml";
}

containers =
{
    example = ["docker.io", "nginx", "latest"];
}

install
{  
    merge
    (
        file1 = "/root/main-config.xml";
        file2 = "/root/xml-updates/";
        backupPath = "/root/backup/";
    );
}

Example 3 - Merging without backup

This example merges /root/new-settings.xml into /root/settings.xml without creating a backup.

languageversion = "1.0.0";
apiversion = "kubernative/kubeops/sina/user/v4";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";

files =
{
    input = "template.yaml";
}

containers =
{
    example = ["docker.io", "nginx", "latest"];
}

install
{  
    merge
    (
        file1 = "/root/settings.xml";
        file2 = "/root/new-settings.xml";
    );
}