if __name__ == '__main__': try: instance_id = sys.argv[1] target_ids = sys.argv[1:] except IndexError: sys.exit('Supply instance_id [instance_id]...') # Print some info print('Initial Auth Info:') for authtype, params in utils.initial_auth_info(ks.auth.client.session): print(' %s' % authtype) print(' %s' % params) print('Access Info:') for k, v in utils.access_info_vars(sess).iteritems(): print('* {}: {}'.format(k, v)) retry_count = 3 for instance_id in target_ids: stopped = False try: server = nova.servers.get(instance_id) print('* Stopping %s' % server.name) for i in range(1, retry_count+1): if stopped: break print('** Attempt %d' % i) server.stop() for state in poll_server(server): # TODO(kamidzi): still maybe race condition with SHUTOFF state.
def dump_accessinfo(): for k, v in utils.access_info_vars(sess).iteritems(): print('* {}: {}'.format(k, v))