Esempio n. 1
0
def user_menu():
    while True:
        print("\nPlease enter a Definition Name to deploy it: ")
        print("e.g.")
        print('\033[1m' + "inf-cda30-single\n" + '\033[0m')
        print("\nAlternately type 'help' to see the Definitions again, 'purge'"
              " to remove all deployed environments from cloudbreak, 'nuke' "
              "to remove everything including Cloudbreak/Director, or 'exit' "
              "to exit gracefully")
        selected = str(input(">> "))
        if selected in ['list', 'help']:
            print_intro()
        elif selected in ['exit', 'quit']:
            print('\033[1m' + "Exiting Whoville!" + '\033[0m')
            exit(0)
        elif selected in ['purge']:
            deploy.purge_cloudbreak(for_reals=True, ns=horton.namespace)
        elif selected in ['nuke']:
            infra.nuke_namespace(dry_run=False)
            exit(0)
        elif selected in horton.defs.keys() or selected.startswith('cdh-'):
            autorun(def_key=selected)
            print("\n    Deployment Completed!\n Menu reload in 5 seconds")
            _sleep(5)
        else:
            print("Sorry, that is not recognised, please try again")
Esempio n. 2
0
def purgeDeployment():
    horton.cbd = infra.get_cloudbreak(purge=False, create_wait=0, create=False)
    if horton.cbd:
        init_cbreak_infra()
        deploy.purge_cloudbreak(for_reals=True, ns=horton.namespace)
        return "Purge Complete"
    else:
        return Response("", status=404)