diff options
author | Roman Rakus <rrakus@redhat.com> | 2012-09-21 12:05:20 +0200 |
---|---|---|
committer | Roman Rakus <rrakus@redhat.com> | 2012-09-21 12:05:20 +0200 |
commit | 7faa01fbaed22c074afeab82c4de811f29d6e8d2 (patch) | |
tree | 69a154c97689faee584fc0d1c16dcfb7344efb7e /examples/test_account.py | |
parent | c6f1a3dcdcb0b0fb8e7d52c954b0b1c72d7acdf9 (diff) | |
download | openlmi-providers-7faa01fbaed22c074afeab82c4de811f29d6e8d2.tar.gz openlmi-providers-7faa01fbaed22c074afeab82c4de811f29d6e8d2.tar.xz openlmi-providers-7faa01fbaed22c074afeab82c4de811f29d6e8d2.zip |
account: DeleteInstance of LMI_Identity
Signed-off-by: Roman Rakus <rrakus@redhat.com>
Diffstat (limited to 'examples/test_account.py')
-rwxr-xr-x | examples/test_account.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/examples/test_account.py b/examples/test_account.py index e3bca25..519a2f2 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_identity - delete user or group, parameter InstanceID of identity create_account - creates a new account, parameters: [0] = Name: required, user login name @@ -111,8 +112,7 @@ elif command == "create_account": System = computerSystems[0].path) elif command == "delete_user": -# Listintg users is simple, just query all instances from LMI_Account -# or select only by given Name +# Find user by given name and call DeleteInstance on the instance path if not parameters: usage() sys.exit(1) @@ -125,6 +125,24 @@ elif command == "delete_user": else: print >> sys.stderr, "User does not exist: %s" %parameters[0] +elif command == "delete_identity": +# Have to pass correct InstanceID +# It is in format: +# LMI:UID:user_id +# or +# LMI:GID:group_id + if not parameters: + usage() + sys.exit(1) + + slct = 'select * from LMI_Identity where InstanceID = "%s"' % parameters[0] + + instances = cliconn.ExecQuery('WQL', slct) + if instances: + print cliconn.DeleteInstance(instances[0].path) + else: + print >> sys.stderr, "Identity does not exist: %s" %parameters[0] + else: # unknown command print "Unknown command", command |