Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFE] merge configuration files #175

Open
ckujau opened this issue Jun 4, 2020 · 1 comment
Open

[RFE] merge configuration files #175

ckujau opened this issue Jun 4, 2020 · 1 comment

Comments

@ckujau
Copy link

ckujau commented Jun 4, 2020

I'm looking for a way to merge two (more more) configuration files into one, preferably into a live configuration. Example use case: a fileio backstore has already been setup and is being used right now. A previous configuration file (.json) for a block backstore is available and I want to be able to add that configuration to the running one.

While searching for a feature like this, I've come across a patch for SLES12 against Datera/targetcli which appears to do just that:

+    def do_merge(self, options):
+        '''
+        merge live|FILE_PATH
+
+        Merges the contents of FILE_PATH with the current configuration.
+        In case of conflict, values from FILE_PATH will be used.
+        If any error happens while doing so, the current configuration will
+        be fully rolled back.

Maybe something like this can be integrated into targetcli-fb? Looking to past and present issues, I can't help but think that #155 may be related here:

"What I am looking for, is to describe my desired target configuration and then 
switch to it - keeping the already configured targets, removing not-anymore
configured targets and adding new targets."
@nf-brentsaner
Copy link

In the meanwhile, you could probably just use any generic JSON merging tool against the saveconfig JSON files, merging the newer one on top of the older one.

One such example is this Python library. The indomitable jq utility can also do this.

Once you have a merged config, you can just load it with a targetcli restoreconfig cmd (or a targetctl restore, etc.).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants