本文整理汇总了Python中appscale.tools.appscale.AppScale.down方法的典型用法代码示例。如果您正苦于以下问题:Python AppScale.down方法的具体用法?Python AppScale.down怎么用?Python AppScale.down使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类appscale.tools.appscale.AppScale
的用法示例。
在下文中一共展示了AppScale.down方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testDownWithEC2EnvironmentVariables
# 需要导入模块: from appscale.tools.appscale import AppScale [as 别名]
# 或者: from appscale.tools.appscale.AppScale import down [as 别名]
def testDownWithEC2EnvironmentVariables(self):
# if the user wants us to use their EC2 credentials when running AppScale,
# we should make sure they get set
appscale = AppScale()
# Mock out the actual file reading itself, and slip in a YAML-dumped
# file
contents = {
'infrastructure' : 'ec2',
'machine' : 'ami-ABCDEFG',
'keyname' : 'bookey',
'group' : 'boogroup',
'min_machines' : 1,
'max_machines' : 1,
'EC2_ACCESS_KEY' : 'access key',
'EC2_SECRET_KEY' : 'secret key'
}
yaml_dumped_contents = yaml.dump(contents)
self.addMockForAppScalefile(appscale, yaml_dumped_contents)
# finally, mock out the actual appscale-terminate-instances call
flexmock(AppScaleTools)
AppScaleTools.should_receive('terminate_instances')
appscale.down()
self.assertEquals('access key', os.environ['EC2_ACCESS_KEY'])
self.assertEquals('secret key', os.environ['EC2_SECRET_KEY'])
示例2: testDownWithCloudAppScalefile
# 需要导入模块: from appscale.tools.appscale import AppScale [as 别名]
# 或者: from appscale.tools.appscale.AppScale import down [as 别名]
def testDownWithCloudAppScalefile(self):
# calling 'appscale down' with an AppScalefile in the local
# directory should collect any parameters needed for the
# 'appscale-terminate-instances' command and then exec it
appscale = AppScale()
# Mock out the actual file reading itself, and slip in a YAML-dumped
# file
contents = {
'infrastructure' : 'ec2',
'machine' : 'ami-ABCDEFG',
'keyname' : 'bookey',
'group' : 'boogroup',
'verbose' : True,
'min_machines' : 1,
'max_machines' : 1
}
yaml_dumped_contents = yaml.dump(contents)
self.addMockForAppScalefile(appscale, yaml_dumped_contents)
# finally, mock out the actual appscale-terminate-instances call
flexmock(AppScaleTools)
AppScaleTools.should_receive('terminate_instances')
appscale.down()
示例3: main
# 需要导入模块: from appscale.tools.appscale import AppScale [as 别名]
# 或者: from appscale.tools.appscale.AppScale import down [as 别名]
#.........这里部分代码省略.........
appscale.set(sys.argv[2], sys.argv[3])
except Exception as exception:
LocalState.generate_crash_log(exception, traceback.format_exc())
sys.exit(1)
elif command == "tail":
if len(sys.argv) < 3:
# by default, tail the first node's logs, since that node is
# typically the head node
index = 0
else:
index = sys.argv[2]
if len(sys.argv) < 4:
# by default, tail the AppController logs, since that's the
# service we most often tail from
regex = "controller*"
else:
regex = sys.argv[3]
try:
appscale.tail(index, regex)
except KeyboardInterrupt:
# don't print the stack trace on a Control-C
pass
except Exception as exception:
LocalState.generate_crash_log(exception, traceback.format_exc())
sys.exit(1)
elif command == "logs":
if len(sys.argv) < 3:
cprint("Usage: appscale logs <location to copy logs to>", 'red')
sys.exit(1)
try:
appscale.logs(sys.argv[2], sys.argv[3:])
except Exception as exception:
LocalState.generate_crash_log(exception, traceback.format_exc())
sys.exit(1)
elif command == "destroy":
cprint("Warning: destroy has been deprecated. Please use 'down'.", 'red')
sys.exit(1)
elif command == "clean":
cprint("Warning: clean has been deprecated. Please use 'down --clean'.", 'red')
sys.exit(1)
elif command == "down":
if len(sys.argv) > 4:
cprint("Usage: appscale down [--clean][--terminate]", 'red')
sys.exit(1)
to_clean = False
to_terminate = False
for index in range(2, len(sys.argv)):
if sys.argv[index] == "--terminate":
to_terminate = True
elif sys.argv[index] == "--clean":
to_clean = True
else:
cprint("Usage: appscale down [--clean][--terminate]", 'red')
sys.exit(1)
try:
appscale.down(clean=to_clean, terminate=to_terminate)
except Exception as exception:
LocalState.generate_crash_log(exception, traceback.format_exc())
sys.exit(1)
elif command == "relocate":
if len(sys.argv) != 5:
cprint("Usage: appscale relocate appid http_port https_port", 'red')
sys.exit(1)
try:
appscale.relocate(sys.argv[2], sys.argv[3], sys.argv[4])
except Exception as exception:
LocalState.generate_crash_log(exception, traceback.format_exc())
sys.exit(1)
elif command == "register":
try:
if len(sys.argv) != 3:
cprint("Usage: appscale register <deployment ID>", "red")
print("You can obtain a deployment ID from {0}"
.format(RegistrationHelper.ADD_DEPLOYMENT_URL))
sys.exit(1)
appscale.register(sys.argv[2])
except Exception as exception:
LocalState.generate_crash_log(exception, traceback.format_exc())
sys.exit(1)
elif command in ["--version", "-v"]:
print APPSCALE_VERSION
sys.exit(0)
elif command == "upgrade":
try:
appscale.upgrade()
except Exception as exception:
LocalState.generate_crash_log(exception, traceback.format_exc())
sys.exit(1)
else:
print(AppScale.USAGE)
if command == "help":
sys.exit(0)
else:
sys.exit(1)