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


Python VCA.get_service_type方法代码示例

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


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

示例1: test_0001

# 需要导入模块: from pyvcloud.vcloudair import VCA [as 别名]
# 或者: from pyvcloud.vcloudair.VCA import get_service_type [as 别名]
 def test_0001(self):
     """Identify vCloud Director Standalone"""
     vca = VCA(host='https://p1v21-vcd.vchs.vmware.com', username='', verify=True, log=True)
     assert vca is not None
     service_type = vca.get_service_type()
     assert service_type == VCA.VCA_SERVICE_TYPE_STANDALONE
开发者ID:digideskio,项目名称:pyvcloud,代码行数:8,代码来源:vca_type_tests.py

示例2: test_0021

# 需要导入模块: from pyvcloud.vcloudair import VCA [as 别名]
# 或者: from pyvcloud.vcloudair.VCA import get_service_type [as 别名]
 def test_0021(self):
     """Identify vCloud Air vca"""
     vca = VCA(host='https://iam.vchs.vmware.com', username='', verify=True, log=True)
     assert vca is not None
     service_type = vca.get_service_type()
     assert service_type == VCA.VCA_SERVICE_TYPE_VCA
开发者ID:digideskio,项目名称:pyvcloud,代码行数:8,代码来源:vca_type_tests.py

示例3: test_0023

# 需要导入模块: from pyvcloud.vcloudair import VCA [as 别名]
# 或者: from pyvcloud.vcloudair.VCA import get_service_type [as 别名]
 def test_0023(self):
     """Identify standalone is not vCloud Air vca"""
     vca = VCA(host='https://p1v21-vcd.vchs.vmware.com', username='', verify=True, log=True)
     assert vca is not None
     service_type = vca.get_service_type()
     assert service_type != VCA.VCA_SERVICE_TYPE_VCA
开发者ID:digideskio,项目名称:pyvcloud,代码行数:8,代码来源:vca_type_tests.py

示例4: __init__

# 需要导入模块: from pyvcloud.vcloudair import VCA [as 别名]
# 或者: from pyvcloud.vcloudair.VCA import get_service_type [as 别名]

#.........这里部分代码省略.........
                self.config.remove_option(section, 'org')
            else:
                self.config.set(section, 'org', self.vca.org)
            if self.vca.vcloud_session.url is None:
                self.config.remove_option(section, 'session_uri')
            else:
                self.config.set(section, 'session_uri',
                                self.vca.vcloud_session.url)
            if self.vca.vcloud_session.org_url is None:
                self.config.remove_option(section, 'org_url')
            else:
                self.config.set(section, 'org_url',
                                self.vca.vcloud_session.org_url)
            if self.vca.vcloud_session.token is None:
                self.config.remove_option(section, 'session_token')
            else:
                self.config.set(section, 'session_token',
                                self.vca.vcloud_session.token)
            if self.vdc_name is None:
                self.config.remove_option(section, 'vdc')
            else:
                self.config.set(section, 'vdc', self.vdc_name)
            if self.gateway is None:
                self.config.remove_option(section, 'gateway')
            else:
                self.config.set(section, 'gateway', self.gateway)
        with open(os.path.expanduser(profile_file), 'w+') as configfile:
            self.config.write(configfile)

    def login(self, host, username, password, instance, org, version,
              save_password=True):
        self.vca = VCA(host=host, username=username, version=version,
                       verify=self.verify, log=self.debug)
        service_type = self.vca.get_service_type()
        if service_type == VCA.VCA_SERVICE_TYPE_UNKNOWN:
            raise Exception('service type unknown')
        self.vca.service_type = service_type
        if VCA.VCA_SERVICE_TYPE_STANDALONE == service_type and \
           org is None:
            self.error_message = 'Org can\'t be null'
            return False
        result = self.vca.login(password=password, org=org)
        if result:
            Log.debug(self.logger, 'logged in, org=%s' % self.vca.org)
            if VCA.VCA_SERVICE_TYPE_STANDALONE == service_type:
                result = self.vca.vcloud_session.login(token=self.vca.
                                                       vcloud_session.token)
                assert result
            if save_password:
                self.password = password
            self.save_config(self.profile, self.profile_file)
        return result

    def re_login_vcloud_session(self):
        Log.debug(self.logger, 'about to re-login vcloud_session vca=%s' %
                  self.vca)
        if self.vca.vcloud_session is not None:
            Log.debug(self.logger, 'about to re-login vcloud_session=%s' %
                      self.vca.vcloud_session)
            if self.vca.vcloud_session.token is not None:
                Log.debug(self.logger,
                          'about to re-login vcloud_session token=%s' %
                          self.vca.vcloud_session.token)
        if self.vca.vcloud_session is not None and \
           self.vca.vcloud_session.token is not None:
            result = self.vca.vcloud_session.login(
开发者ID:digideskio,项目名称:vca-cli,代码行数:70,代码来源:cmd_proc.py


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