Deal better with non-shell-normalized class and object names
Opened this issue · 1 comments
Q:
Is there a way to get a list of all config objects that doesn't rename them? We use dashes and underscores in object names often and the output from dpxmlsh_get_config_list renames the objects so that its output cannot be used as input. A recent use case was to disable SSL3 in all Crypto Profiles. There's no good way to get a list of these with the tool. I ended up doing a dpxmlsh_ls, grepping for .cfg files, doing a dpxmlsh_get_file on those, and then grepping for CryptoProfile just to get the names of all the CryptoProfiles. If dpxmlsh_get_config_list had not renamed objects (or at least done so in a reconstructable fashion), I would have been able to use that output.
A: As for how to get a list of class+object names that are not normalized for shell, try something like this:
dpxmlsh_soma_get_config | xmlstarlet sel --text -N dp="http://www.datapower.com/schemas/management" --template --match '//dp:config/*' --value-of 'name(.)' -o "::" --value-of '@name' --nl
follow-up Q: that is some trickery there using your internal functions. I'll have to take a look at that.
follow-up A: No trickery involved! Everything dpxmlsh does is based on the xml, it only seemed reasonable to make it easy to get to the xml itself as well. It's just lower level access. The internal functions are all called "dpxmlsh", note the leading "_". XML is the native management language, and it only makes sense that it is easy to access.