import subaccounts

iam_root = subaccounts.get_root_IAM_connection()

maybe_yes = raw_input("Delete all identities on account? Are you sure? (yes/NO) ");

if maybe_yes != "yes":
    print "Not proceeding"
    sys.exit(1)

subaccounts.init_db()
for user in iam_root.get_all_users()['list_users_response']['list_users_result']['users']:
    print "Deleting user ", user
    subaccounts.delete_user(user['user_name'])

Exemple #2
0
parser.add_option('--set-password', action='store_true', default=False)
(options, args) = parser.parse_args(sys.argv[1:])
opt = vars(options)

REAL_USERNAME = audit.real_username()

if not REAL_USERNAME.startswith("cs61c"):
   raise Error("Only for CS61C accounts")

need_config_setup = False
need_initial_keys = False
user = None

if opt['delete_account']:
    print "Deleting EC2 account..."
    subaccounts.delete_user(REAL_USERNAME)
    if !opt['init']:
        sys.exit(0)
    
if opt['init']:
    if not subaccounts.user_exists(REAL_USERNAME):
        print "Creating account...",
        user = subaccounts.make_user(REAL_USERNAME)
        print "done"
        need_initial_keys = True
    else:
        print "Using existing account."

    need_config_setup = True

if user is None:
import subaccounts

iam_root = subaccounts.get_root_IAM_connection()

maybe_yes = raw_input(
    "Delete all identities on account? Are you sure? (yes/NO) ")

if maybe_yes != "yes":
    print "Not proceeding"
    sys.exit(1)

subaccounts.init_db()
for user in iam_root.get_all_users(
)['list_users_response']['list_users_result']['users']:
    print "Deleting user ", user
    subaccounts.delete_user(user['user_name'])