Change in ovirt-engine-cli[cli_3.6]: cli: Iterate all permutations of parent identifiers
juan.hernandez at redhat.com
juan.hernandez at redhat.com
Wed May 18 18:01:20 UTC 2016
Juan Hernandez has submitted this change and it was merged.
Change subject: cli: Iterate all permutations of parent identifiers
......................................................................
cli: Iterate all permutations of parent identifiers
When the CLI processes a command that contains multiple parent
identifiers it should process all the permutations in order to find the
correct collection. For example, for the following command:
# add vm --id 123 \
--parent-cluster-identifier 456 \
--parent-affinitygroup-identifier 789
The CLI should try the following permutations:
1) --parent-cluster-identifier, --parent-affinitygroup-identifier
2) --parent-affinitygroup-identifier, --parent-cluster-identifier
Which should result in trying the following API URLs:
1) /clusters/456/affinitygroups/789
2) /affinitygroups/789/clusters/456
The first will work, the second will not, as it doesn't exist.
This is theory, but in practice the CLI doesn't try these permutations
correctly, only the first one.
In addition the ordering of the permutations depends on the names of the
options. For example, if the options don't have the "parent" prefix,
then the order of the permutations will be different, and the first one,
the only actually tried, will also be different.
This patch fixes the code that tries these permutations, so that it will
actually try all of them, till one succeeds.
Change-Id: I9ea62ef10f8cf04d9e7ee54b2ac420555bd567be
Bug-Url: https://bugzilla.redhat.com/1335844
Signed-off-by: Juan Hernandez <juan.hernandez at redhat.com>
---
M src/ovirtcli/command/command.py
1 file changed, 58 insertions(+), 35 deletions(-)
Approvals:
Ondra Machacek: Looks good to me, but someone else must approve
Juan Hernandez: Verified; Looks good to me, approved; Passed CI tests
--
To view, visit https://gerrit.ovirt.org/57403
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I9ea62ef10f8cf04d9e7ee54b2ac420555bd567be
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine-cli
Gerrit-Branch: cli_3.6
Gerrit-Owner: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Ondra Machacek <omachace at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
More information about the Engine-commits
mailing list