To test the ability of my code to deal properly with policy packages with empty installation targets, I'm trying to build such a policy package. It's easy in SmartConsole, but I'm not sure how to do it via the API.
[Expert@TestSC:0]# mgmt_cli -s session.txt add package name "Installed_Nowhere" access true installation-targets "none"
code: "generic_err_object_not_found"
message: "Requested object [none] not found"
[Expert@TestSC:0]# mgmt_cli -s session.txt add package name "Installed_Nowhere" access true installation-targets ""
code: "generic_err_object_not_found"
message: "Requested object [] not found"
[Expert@TestSC:0]# mgmt_cli -s session.txt add package name "Installed_Nowhere" access true installation-targets "[]"
[Expert@TestSC:0]# mgmt_cli -f json -s session.txt show package name "Installed_Nowhere" details-level full | jq '."installation-targets"'
"all"
[Expert@TestSC:0]# mgmt_cli -s session.txt discard
number-of-discarded-changes: 1
message: "OK"
[Expert@TestSC:0]# mgmt_cli -s session.txt add package name "Installed_Nowhere" access true
[Expert@TestSC:0]# mgmt_cli -f json -s session.txt show package name "Installed_Nowhere" details-level full | jq '."installation-targets"'
"all"
[Expert@TestSC:0]# mgmt_cli -s session.txt set package name "Installed_Nowhere" installation-targets.remove "all"
code: "generic_err_object_not_found"
message: "Requested object [all] not found"
Meanwhile, on a real box I have with a policy I built in SmartConsole:
[Expert@StandingLab:0]# mgmt_cli -f json -r true show package name "Installed_Nowhere" details-level full | jq '."installation-targets"'
[]
Is there a special value I can pass to 'add package' to get it to build a package with an empty installation targets list?
Separately, I have tried building it with a single installation target, then removing that target. That causes the property to change to "all" rather than to an empty list. That seems very unlikely to be expected behavior.