diff options
author | dongwenjuan <dong.wenjuan@zte.com.cn> | 2018-01-10 09:42:05 +0800 |
---|---|---|
committer | dongwenjuan <dong.wenjuan@zte.com.cn> | 2018-01-10 09:42:05 +0800 |
commit | f106c5a12724c684d747cf7f309f0ccc8b86cc61 (patch) | |
tree | 43ec5c5aebd19c9ce0838033f5821d89c93f4194 /tests/clean.py | |
parent | 9fd701278bf7d8c5b9451491bcb1a92580adc780 (diff) |
remove useless bash code
Change-Id: I530ef7fcdc4f9539517c5a2718e596f77de772a6
Signed-off-by: dongwenjuan <dong.wenjuan@zte.com.cn>
Diffstat (limited to 'tests/clean.py')
-rw-r--r-- | tests/clean.py | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/tests/clean.py b/tests/clean.py deleted file mode 100644 index f8394055..00000000 --- a/tests/clean.py +++ /dev/null @@ -1,45 +0,0 @@ -############################################################################## -# Copyright (c) 2016 NEC Corporation and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -import argparse -import json -import os - -import novaclient.client as novaclient - - -nova_api_version = '2.11' - -def enable_compute_host(hostname): - self.nova = novaclient.Client(self.nova_api_version, - os.environ['OS_USERNAME'], - os.environ['OS_PASSWORD'], - os.environ['OS_TENANT_NAME'], - os.environ['OS_AUTH_URL'], - connection_pool=True) - opts = {'all_tenants': True, 'host': hostname} - for server in self.nova.servers.list(detailed=False, search_opts=opts): - self.nova.servers.reset_state(server, 'active') - self.nova.services.force_down(hostname, 'nova-compute', False) - - -def get_args(): - parser = argparse.ArgumentParser(description='Doctor Test Cleaner') - parser.add_argument('hostname', metavar='HOSTNAME', type=str, nargs='?', - help='a hostname to be re-enable') - return parser.parse_args() - - -def main(): - args = get_args() - enable_compute_host(args.hostname) - - -if __name__ == '__main__': - main() |