diff options
author | Roman Rakus <rrakus@redhat.com> | 2012-09-21 13:06:24 +0200 |
---|---|---|
committer | Roman Rakus <rrakus@redhat.com> | 2012-09-21 13:06:24 +0200 |
commit | 1285ef838782a6399606fc5af96e288236edf8e2 (patch) | |
tree | 0edba1d4488e50e0409e559dedf59ba2f3219b7c /examples/test_account.py | |
parent | 7faa01fbaed22c074afeab82c4de811f29d6e8d2 (diff) | |
download | openlmi-providers-1285ef838782a6399606fc5af96e288236edf8e2.tar.gz openlmi-providers-1285ef838782a6399606fc5af96e288236edf8e2.tar.xz openlmi-providers-1285ef838782a6399606fc5af96e288236edf8e2.zip |
account: DeleteInstance on LMI_Group
Signed-off-by: Roman Rakus <rrakus@redhat.com>
Diffstat (limited to 'examples/test_account.py')
-rwxr-xr-x | examples/test_account.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/examples/test_account.py b/examples/test_account.py index 519a2f2..d35da78 100755 --- a/examples/test_account.py +++ b/examples/test_account.py @@ -12,6 +12,7 @@ Available commands and their parameters: list_group - list groups, parameter is group name or empty for all group_members - list members of group, parameter is group name delete_user - delete account, needed parameter is account name + delete_group - delete group, needed parameter is group name delete_identity - delete user or group, parameter InstanceID of identity create_account - creates a new account, parameters: [0] = Name: required, user login name @@ -125,6 +126,20 @@ elif command == "delete_user": else: print >> sys.stderr, "User does not exist: %s" %parameters[0] +elif command == "delete_group": +# Find group by given name and call DeleteInstance on the instance path + if not parameters: + usage() + sys.exit(1) + + slct = 'select * from LMI_Group where Name = "%s"' % parameters[0] + + instances = cliconn.ExecQuery('WQL', slct) + if instances: + print cliconn.DeleteInstance(instances[0].path) + else: + print >> sys.stderr, "Group does not exist: %s" %parameters[0] + elif command == "delete_identity": # Have to pass correct InstanceID # It is in format: |