Hi, First a description of what I'd like to accomplish: - I'm using crmsh to retrieve a cluster configuration by using "crm configure save /tmp/file". - I am then reading the bytes from the '/tmp/file' into a string that I'm modifying elsewhere. - I remove some lines from that cluster configuration string (eg, removed a stopped resource clone set and primitive). - Now I want to replace the running cluster configuration with this new/updated string, so I put the string back into a new file, and run "crm configure load replace /tmp/new_file". - Actually, using the "replace" method for the load command gives me an error and doesn't erase the current configuration because other resources are running, and that's okay. - Instead I use "crm configure load update /tmp/new_file" and no errors are given since it doesn't try to erase the configuration first. - In both cases of "configure load" (replace and update) lines are not removed from the configuration.
Using "configure edit" does remove deleted lines from the configuration and I'd like to accomplish this same behavior by reading a file (importing). Looking at the source (master branch on GitHub for crmsh) of modules/cibconfig.py I see that the behavior of removing lines (or not) is in this method: --snip-- def import_file(self, method, fname): ''' method: update or replace ''' if not cib_factory.is_cib_sane(): return False f = self._open_url(fname) if not f: return False s = f.read() if f != sys.stdin: f.close() return self.save(s, no_remove=True, method=method) --snip-- Setting no_remove to False produces the behavior where missing configuration lines from the import are removed from the configuration (or not added in). My question: Is there any other way to replicate this behavior using crmsh and importing a configuration from a file? If not, would the group be open to accepting a patch that adds a third load-action method that calls save() with no_remove=False? --Marc _______________________________________________ Users mailing list: Users@clusterlabs.org http://clusterlabs.org/mailman/listinfo/users Project Home: http://www.clusterlabs.org Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf Bugs: http://bugs.clusterlabs.org