Example #1
0
except GetoptError as err:
    print str(err)  # will print something like "option -a not recognized"
    usage()
    sys.exit(2)

for opt, opt_arg in opts:
    if opt in ('-h', '--help'):
        usage()
        sys.exit(0)
    if opt in ('-c', '--config'):
        config_file = opt_arg
    else:
        assert False, "unhandled option: %s" % opt

if len(args) > 0:
    user_file = args[0]

#
# Script proper
#

mgr = OrgMgr(config_file)

print "Fetching users and teams from %s. This may take a while..." \
    % user_file
print "Failed users (if any):"
teams = mgr.read_teams_from_csv(user_file)

print "Adding teams to organization"
mgr.add_teams_to_org(teams)
Example #2
0
config_file = 'ghorg.conf'

try:
    opts, args = getopt(sys.argv[1:], "hc:", ['help', 'config='])
except GetoptError as err:
    print str(err)  # will print something like "option -a not recognized"
    usage()
    sys.exit(2)

for opt, opt_arg in opts:
    if opt in ('-h', '--help'):
        usage()
        sys.exit(0)
    if opt in ('-c', '--config'):
        config_file = opt_arg
    else:
        assert False, "unhandled option: %s" % opt

if len(args) != 1:
    print "Expected 1 argument (project name prefix), but got %d" % len(args)
    sys.exit(2)

# Check whether the name prefix is long enough.
prefix = args[0]

# Read config, fetch organization
mgr = OrgMgr(config_file)

# DELETE the teams
mgr.delete_teams_from_org(prefix)
Example #3
0
except GetoptError as err:
    print str(err)  # will print something like "option -a not recognized"
    usage()
    sys.exit(2)

for opt, opt_arg in opts:
    if opt in ('-h', '--help'):
        usage()
        sys.exit(0)
    if opt in ('-c', '--config'):
        config_file = opt_arg
    else:
        assert False, "unhandled option: %s" % opt

if len(args) > 0:
    user_file = args[0]

#
# Script proper
#

mgr = OrgMgr(config_file)

print "Fetching users and teams from %s. This may take a while..." \
    % user_file
print "Failed users (if any):"
teams = mgr.read_teams_from_csv(user_file)

print "Adding teams to organization"
mgr.add_teams_to_org(teams)
Example #4
0
config_file = 'ghorg.conf'

try:
    opts, args = getopt(sys.argv[1:], "hc:", ['help', 'config='])
except GetoptError as err:
    print str(err)  # will print something like "option -a not recognized"
    usage()
    sys.exit(2)

for opt, opt_arg in opts:
    if opt in ('-h', '--help'):
        usage()
        sys.exit(0)
    if opt in ('-c', '--config'):
        config_file = opt_arg
    else:
        assert False, "unhandled option: %s" % opt

if len(args) != 1:
    print "Expected 1 argument (project name prefix), but got %d" % len(args)
    sys.exit(2)

# Check whether the name prefix is long enough.
prefix = args[0]

# Read config, fetch organization
mgr = OrgMgr(config_file)

# DELETE the teams
mgr.delete_teams_from_org(prefix)