print(('-- User \'', userB, '\' created successfully.'))

    #
    # Create test teams
    #
    # Possible failures on Team creation might include having reached the
    # max limit on Teams for this customer account or if the Team by that
    # name already exists. Since a previous successful run of this test
    # would have deleted the Team by the same name, and we need to be able
    # to configure Teams for this test to pass, we'll treat both types of
    # error as a genuine fail of the test.
    #

    print('Creating test teams...')

    ok, res = sdclient.create_team(teamA)
    if not ok:
        print(('-- Team creation failed:', res, '. Exiting.'))
        sys.exit(1)
    else:
        print(('-- Team \'', teamA, '\' created successfully.'))

    ok, res = sdclient.create_team(teamB)
    if not ok:
        print(('-- Team creation failed:', res, '. Exiting.'))
        sys.exit(1)
    else:
        print(('-- Team \'', teamB, '\' created successfully.'))

    #
    # Membership manipulation
Exemplo n.º 2
0
# Instantiate the SDC client
#
sdclient = SdcClient(sdc_token, sdc_url='https://app-staging.sysdigcloud.com')

team_name = sys.argv[2]
user_name = sys.argv[3]

print 'Trying to invite a user ', user_name
res = sdclient.create_user_invite(user_name)
if res[0] == False:
    print 'User creation failed: ', res[1]
else:
    print 'User creation succeeded'

print 'Now trying to create a team with name ', team_name
res = sdclient.create_team(team_name)
if res[0] == False:
    print 'Team creation failed: ', res[1]
else:
    print 'Team creation succeeded.', res[1]

print 'Now trying to find team with name ', team_name
res = sdclient.get_team(team_name)
if res[0] == False:
    print 'Could not get team info'
else:
    print 'Team fetch succeeded'

print 'Now trying to edit team ', team_name
res = sdclient.edit_team(team_name,
                         description='Nextgen2',
Exemplo n.º 3
0
sdc_token = os.environ['SYSDIG_API_TOKEN']

# Instantiate the Sysdig client

sdclient = SdcClient(sdc_token)



#### TEAM CREATION ColonialOne ####
nsfilter="kubernetes.namespace.name='devops-wekan'"


print (filter)
print('Now trying to create a team with name:', 'ColonialOne')

ok, res = sdclient.create_team( 'ColonialOne', filter=nsfilter, show="container" )
if not ok:
    print('Team creation failed:', res, '. Exiting.')
else:
    print('Team creation succeeded.', res)



#### USER INVITES ColonialOne ####
print('Trying to invite a user:'******'*****@*****.**')
ok, res = sdclient.create_user_invite('*****@*****.**')
if not ok:
    if res == 'user ' + '*****@*****.**' + ' already exists':
        print('User creation failed because', '*****@*****.**', 'already exists. Continuing.')
    else:
        print('User creation failed:', res, '. Exiting.')