add command invalidate
This commit is contained in:
parent
faba1dbabc
commit
4d0a0608ca
|
@ -6,7 +6,7 @@ import pickle
|
|||
import subprocess
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("action", default="dump", choices=["tenantinfo", "tenanturls", "dump", "restore"])
|
||||
parser.add_argument("action", default="dump", choices=["tenantinfo", "tenanturls", "dump", "restore", "invalidate"])
|
||||
parser.add_argument("host", help="origin host")
|
||||
parser.add_argument("tenant", help="hobo tenant url")
|
||||
parser.add_argument("--update", action="store_true")
|
||||
|
@ -147,11 +147,18 @@ def get_tenant_info(tenant_name):
|
|||
return tenant_infos[0]
|
||||
|
||||
|
||||
def invalidate(tenant_name):
|
||||
tenant_info = get_tenant_info(tenant_name)
|
||||
for service in tenant_info['services']:
|
||||
bpath = "%s/%s" % (service['path'], service['url'])
|
||||
run('ssh %s.%s sudo mv %s %s.invalid' % (service['name'], args.host, bpath, bpath))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if args.action == "tenantinfo":
|
||||
get_host_info()
|
||||
print(json.dumps(get_tenant_info(args.tenant), indent=4))
|
||||
if args.action == "tenanturls":
|
||||
elif args.action == "tenanturls":
|
||||
print(' '.join([x['url'] for x in get_tenant_info(args.tenant)['services']]))
|
||||
elif args.action == "dump":
|
||||
get_host_info()
|
||||
|
@ -162,3 +169,5 @@ if __name__ == "__main__":
|
|||
tenant = get_tenant_info(args.tenant)
|
||||
restore_tenant_files(tenant)
|
||||
restore_tenant_databases(tenant)
|
||||
elif args.action == "invalidate":
|
||||
invalidate(args.tenant)
|
||||
|
|
Reference in New Issue