Author: jfthomps
Date: Tue Nov 16 19:13:26 2010
New Revision: 1035752

URL: http://svn.apache.org/viewvc?rev=1035752&view=rev
Log:
modified addUserGroup - added options.custom argument to 
caller.XMLRPCaddUserGroup

modified printHelp - include information about custom flag

modified if conditional for addUserGroup to handle custom flag

Modified:
    incubator/vcl/sandbox/useful_scripts/managegroups.py

Modified: incubator/vcl/sandbox/useful_scripts/managegroups.py
URL: 
http://svn.apache.org/viewvc/incubator/vcl/sandbox/useful_scripts/managegroups.py?rev=1035752&r1=1035751&r2=1035752&view=diff
==============================================================================
--- incubator/vcl/sandbox/useful_scripts/managegroups.py (original)
+++ incubator/vcl/sandbox/useful_scripts/managegroups.py Tue Nov 16 19:13:26 
2010
@@ -143,7 +143,7 @@ class VCLServerProxy(xmlrpclib.ServerPro
 
 def addUserGroup(options):
        caller = VCLServerProxy(options.vclurl, options.vcluser, 
options.vclpass)
-       rc = caller.XMLRPCaddUserGroup(options.name, options.affiliation, 
options.owner, options.managingGroup, options.initialmax, options.totalmax, 
options.maxextend)
+       rc = caller.XMLRPCaddUserGroup(options.name, options.affiliation, 
options.owner, options.managingGroup, options.initialmax, options.totalmax, 
options.maxextend, options.custom)
        if(rc['status'] == 'error'):
                print  'ERROR: There was an error with the API call: ' + 
rc['errormsg']
                sys.exit(5)
@@ -272,7 +272,9 @@ def printHelp(command='all'):
                print "    -m ManagingGroup - name of user group that can 
manage membership of the new group"
                print "    -i InitialMaxTime - (minutes) max initial time users 
in this group can select for length of reservations"
                print "    -t TotalMaxTime - (minutes) total length users in 
the group can have for a reservation (including all extensions)"
-               print "    -x MaxExtendTime - (minutes) max length of time 
users can request as an extension to a reservation at a time\n"
+               print "    -x MaxExtendTime - (minutes) max length of time 
users can request as an extension to a reservation at a time"
+               print "    -c custom (optional, default=1) - whether or not the 
group should be created as a custom group; if not custom "
+               print "                                      the group 
membership will be managed via the user's authentication protocol\n"
        if command == 'all' or command == 'getUserGroupAttributes':
                print "  getUserGroupAttributes - gets information about a user 
group"
                print "  parameters:"
@@ -374,13 +376,17 @@ if command == 'addUserGroup':
        parser.add_option('-i', dest='initialmax')
        parser.add_option('-t', dest='totalmax')
        parser.add_option('-x', dest='maxextend')
+       parser.add_option('-c', dest='custom', default=1)
        (options, remaining) = parser.parse_args(args)
        if len(remaining):
                print "ERROR: Incorrect number of parameters specified\n";
                printHelp('addUserGroup')
                sys.exit(2)
-       if options.name and options.affiliation and options.owner and 
options.managingGroup and options.initialmax and options.totalmax and 
options.maxextend:
+       if options.custom == '1' and options.name and options.affiliation and 
options.owner and options.managingGroup and options.initialmax and 
options.totalmax and options.maxextend:
                pass
+       elif options.custom == '0' and options.name and options.affiliation and 
options.initialmax and options.totalmax and options.maxextend:
+               options.owner = ''
+               options.managingGroup = ''
        else:
                print "ERROR: Incorrect number of parameters specified\n";
                printHelp('addUserGroup')


Reply via email to