当前位置: 首页>>代码示例>>Python>>正文


Python AppScale.get方法代码示例

本文整理汇总了Python中appscale.tools.appscale.AppScale.get方法的典型用法代码示例。如果您正苦于以下问题:Python AppScale.get方法的具体用法?Python AppScale.get怎么用?Python AppScale.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在appscale.tools.appscale.AppScale的用法示例。


在下文中一共展示了AppScale.get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testGetPropertyWithAppScalefile

# 需要导入模块: from appscale.tools.appscale import AppScale [as 别名]
# 或者: from appscale.tools.appscale.AppScale import get [as 别名]
  def testGetPropertyWithAppScalefile(self):
    # calling 'appscale get' with an AppScalefile in the local
    # directory should collect any parameters needed for the
    # 'appscale-get-property' 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-get-property call
    flexmock(AppScaleTools)
    AppScaleTools.should_receive('get_property')
    appscale.get('.*')
开发者ID:AppScale,项目名称:appscale-tools,代码行数:26,代码来源:test_appscale.py

示例2: main

# 需要导入模块: from appscale.tools.appscale import AppScale [as 别名]
# 或者: from appscale.tools.appscale.AppScale import get [as 别名]

#.........这里部分代码省略.........
          sys.exit(1)
        appscale.deploy(sys.argv[4], sys.argv[3])
    except Exception as exception:
      LocalState.generate_crash_log(exception, traceback.format_exc())
      sys.exit(1)
  elif command == "create-user":
    try:
      if len(sys.argv) < 2 or len(sys.argv) > 3:
        cprint("Usage: appscale create-user [--admin]", 'red')
        sys.exit(1)
      if len(sys.argv) == 3:
        if sys.argv[2] == '--admin':
          appscale.create_user(True)
        else:
          cprint("Error: Invalid argument to 'create-user' command. To create user as admin, "
                 "you should specify the option '--admin'", 'red')
          cprint("Usage: appscale create-user --admin", 'red')
          sys.exit(1)
      elif len(sys.argv) == 2:
        appscale.create_user()
    except Exception as exception:
      LocalState.generate_crash_log(exception, traceback.format_exc())
      sys.exit(1)
  elif command == "undeploy" or command == "remove":
    try:
      if len(sys.argv) != 3:
        cprint("Usage: appscale {0} <path to your app>".format(command), 'red')
        sys.exit(1)

      appscale.undeploy(sys.argv[2])
    except Exception as exception:
      LocalState.generate_crash_log(exception, traceback.format_exc())
      sys.exit(1)
  elif command == "get":
    try:
      if len(sys.argv) != 3:
        cprint("Usage: appscale get <regex of properties to retrieve>", 'red')
        sys.exit(1)

      properties = appscale.get(sys.argv[2])
      for property_name, property_value in sorted(properties.iteritems()):
        print "{0} -> {1}".format(property_name, property_value)
      sys.exit(0)
    except Exception as exception:
      LocalState.generate_crash_log(exception, traceback.format_exc())
      sys.exit(1)
  elif command == "set":
    try:
      if len(sys.argv) != 4:
        cprint("Usage: appscale set <property> <value>", 'red')
        sys.exit(1)

      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
开发者ID:AppScale,项目名称:appscale-tools,代码行数:70,代码来源:appscale.py


注:本文中的appscale.tools.appscale.AppScale.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。