0 Replies Latest reply: Feb 4, 2012 9:01 PM by Asya Kamsky RSS

Two WS example scripts for dealing with groups in v4

Asya Kamsky Coverity Ninja
Currently Being Moderated

Originally published on 2012-02-04 21:01

 

 

These scripts use base classes posted Python base classes for v4/Integrity Manager 5.5 web services sample scripts

They both start with

 

 

from WebService import WebServiceClient
from WebService import WSOpts
from ConfigService import ConfigServiceClient
import sys
import logging 

 

Create group:

 

 

def main():

    wsOpts = WSOpts()
    parser = wsOpts.get_common_opts()

    parser.add_option("--group",    dest="group",  help="Group Name")
    parser.add_option("--ldap",  default=False,  dest="ldap",  action="store_true", help="Ldap")
    parser.add_option("--role",  dest="role",  help="Role to add to group")

    (options, args) = parser.parse_args()
    wsOpts.setLogging(options.debug)

    if wsOpts.checkRequiredMissing(options, ('group',)):
        parser.print_help()
        sys.exit(-1)

    configServiceClient = ConfigServiceClient(options);

    configServiceClient.create_group(options.group,options.ldap,options.role)

if __name__ == '__main__':
    main()

 

Update group name:

 

def main():

    wsOpts = WSOpts()
    parser = wsOpts.get_common_opts()

    parser.add_option("--group",    dest="group",  help="Group Name")
    parser.add_option("--newname",    dest="newname",  help="New name")

    (options, args) = parser.parse_args()
    wsOpts.setLogging(options.debug)

    if wsOpts.checkRequiredMissing(options, ('group','newname')):
        parser.print_help()
        sys.exit(-1)

    configServiceClient = ConfigServiceClient(options);

    configServiceClient.rename_group(options.group,options.newname)

if __name__ == '__main__':

More Like This

  • Retrieving data ...