本文整理汇总了Python中appscale.tools.appscale.AppScale.get_locations_json_file方法的典型用法代码示例。如果您正苦于以下问题:Python AppScale.get_locations_json_file方法的具体用法?Python AppScale.get_locations_json_file怎么用?Python AppScale.get_locations_json_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类appscale.tools.appscale.AppScale
的用法示例。
在下文中一共展示了AppScale.get_locations_json_file方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testTailWithIndexInBounds
# 需要导入模块: from appscale.tools.appscale import AppScale [as 别名]
# 或者: from appscale.tools.appscale.AppScale import get_locations_json_file [as 别名]
def testTailWithIndexInBounds(self):
# calling 'appscale tail 1 *' should tail from the second node
# (nodes[1]). If there are two nodes in this deployment,
# we should tail from it successfully
appscale = AppScale()
contents = { 'keyname' : 'boo' }
yaml_dumped_contents = yaml.dump(contents)
one = {
'public_ip' : 'blarg'
}
two = {
'public_ip' : 'blarg2'
}
nodes = {'node_info': [one, two]}
nodes_contents = json.dumps(nodes)
mock = self.addMockForAppScalefile(appscale, yaml_dumped_contents)
(mock.should_receive('open')
.with_args(appscale.get_locations_json_file('boo'))
.and_return(flexmock(read=lambda: nodes_contents)))
flexmock(subprocess)
subprocess.should_receive('call').with_args(["ssh", "-o",
"StrictHostkeyChecking=no", "-i", appscale.get_key_location('boo'),
"[email protected]", "tail -F /var/log/appscale/c*"]).and_return().once()
appscale.tail(1, "c*")
示例2: testTailWithNoNodesJson
# 需要导入模块: from appscale.tools.appscale import AppScale [as 别名]
# 或者: from appscale.tools.appscale.AppScale import get_locations_json_file [as 别名]
def testTailWithNoNodesJson(self):
# calling 'appscale tail' when there isn't a locations.json
# file should throw up and die
appscale = AppScale()
contents = { 'keyname' : 'boo' }
yaml_dumped_contents = yaml.dump(contents)
mock = self.addMockForAppScalefile(appscale, yaml_dumped_contents)
(mock.should_receive('open')
.with_args(appscale.get_locations_json_file('boo'))
.and_raise(IOError))
self.assertRaises(AppScaleException, appscale.tail, 0, "")
示例3: testTailWithIndexOutOfBounds
# 需要导入模块: from appscale.tools.appscale import AppScale [as 别名]
# 或者: from appscale.tools.appscale.AppScale import get_locations_json_file [as 别名]
def testTailWithIndexOutOfBounds(self):
# calling 'appscale tail 1 *' should tail from the second node
# (nodes[1]). If there's only one node in this deployment,
# we should throw up and die
appscale = AppScale()
contents = { 'keyname' : 'boo' }
yaml_dumped_contents = yaml.dump(contents)
one = {
'public_ip' : 'blarg'
}
nodes = {'node_info': [one]}
nodes_contents = json.dumps(nodes)
mock = self.addMockForAppScalefile(appscale, yaml_dumped_contents)
(mock.should_receive('open')
.with_args(appscale.get_locations_json_file('boo'))
.and_return(flexmock(read=lambda: nodes_contents)))
self.assertRaises(AppScaleException, appscale.tail, 1, '')