當前位置: 首頁>>代碼示例>>Python>>正文


Python NailgunClient.get_api_version方法代碼示例

本文整理匯總了Python中fuelweb_test.models.nailgun_client.NailgunClient.get_api_version方法的典型用法代碼示例。如果您正苦於以下問題:Python NailgunClient.get_api_version方法的具體用法?Python NailgunClient.get_api_version怎麽用?Python NailgunClient.get_api_version使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在fuelweb_test.models.nailgun_client.NailgunClient的用法示例。


在下文中一共展示了NailgunClient.get_api_version方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: debug

# 需要導入模塊: from fuelweb_test.models.nailgun_client import NailgunClient [as 別名]
# 或者: from fuelweb_test.models.nailgun_client.NailgunClient import get_api_version [as 別名]
CLUSTER_CONFIG = os.environ.get("CLUSTER_CONFIG", "test_lab.yaml")

# optional
START_DEPLOYMENT = os.environ.get("START_DEPLOYMENT", "false")
UPLOAD_DEPLOYMENT_INFO = os.environ.get("UPLOAD_DEPLOYMENT_INFO", "false")
IPMI_CONFIGS = os.environ.get("IPMI_CONFIGS", "ipmi/netifnames.yaml")
# debug (don't use it!)
test_mode = False

LOG.info('Try load: %s' % (CLUSTER_CONFIG))
lab_config = yaml.load(open(CLUSTER_CONFIG))

client = NailgunClient(lab_config["fuel-master"])
##################################
# versions workaround
f_release = client.get_api_version()['release']
LOG.info('Fuel-version: \n%s' % pprinter.pformat(client.get_api_version()))
if float(f_release[:3]) < 6:
    api_cluster_id = "cluster_id"
else:
    api_cluster_id = "cluster"
###################################


def fetch_hw_data(config_yaml=IPMI_CONFIGS):
    """

    :param IPMI_CONFIGS:
    :return:
    """
開發者ID:alexz-kh,項目名稱:fuel_manage_env,代碼行數:32,代碼來源:manage_env.py

示例2: FuelWebClient

# 需要導入模塊: from fuelweb_test.models.nailgun_client import NailgunClient [as 別名]
# 或者: from fuelweb_test.models.nailgun_client.NailgunClient import get_api_version [as 別名]

#.........這裏部分代碼省略.........
            for test_name in failed_test_name:
                assert_true(test_name in actual_failed_names,
                            'WARNINg unexpected fail,'
                            'expected {0} actual {1}'.format(
                                failed_test_name, actual_failed_names))

        assert_true(
            failed <= should_fail, 'Failed tests,  fails: {} should fail:'
                                   ' {} failed tests name: {}'
                                   ''.format(failed, should_fail,
                                             failed_tests_res))

    def assert_release_state(self, release_name, state='available'):
        logger.info('Assert release %s has state %s', release_name, state)
        for release in self.client.get_releases():
            if release["name"].find(release_name) != -1:
                assert_equal(release['state'], state,
                             'Release state {0}'.format(release['state']))
                return release["id"]

    def assert_release_role_present(self, release_name, role_name):
        logger.info('Assert role %s is available in release %s',
                    role_name, release_name)
        id = self.assert_release_state(release_name)
        release_data = self.client.get_releases_details(release_id=id)
        assert_equal(
            True, role_name in release_data['roles'],
            message='There is no {0} role in release id {1}'.format(
                role_name, release_name))

    @logwrap
    def assert_fuel_version(self, fuel_version):
        logger.info('Assert fuel version is {0}'.format(fuel_version))
        version = self.client.get_api_version()
        logger.debug('version get from api is {0}'.format(version['release']))
        assert_equal(version['release'], fuel_version,
                     'Release state is not {0}'.format(fuel_version))

    @logwrap
    def assert_nailgun_upgrade_migration(self,
                                         key='can_update_from_versions'):
        for release in self.client.get_releases():
            assert_true(key in release)

    @logwrap
    def assert_task_success(
            self, task, timeout=130 * 60, interval=5, progress=None):
        logger.info('Assert task %s is success', task)
        if not progress:
            task = self.task_wait(task, timeout, interval)
            assert_equal(
                task['status'], 'ready',
                "Task '{name}' has incorrect status. {} != {}".format(
                    task['status'], 'ready', name=task["name"]
                )
            )
        else:
            logger.info('Start to polling task progress')
            task = self.task_wait_progress(
                task, timeout=timeout, interval=interval, progress=progress)
            assert_true(
                task['progress'] >= progress,
                'Task has other progress{0}'.format(task['progress']))

    @logwrap
    def assert_task_failed(self, task, timeout=70 * 60, interval=5):
開發者ID:igajsin,項目名稱:fuel-main,代碼行數:70,代碼來源:fuel_web_client.py


注:本文中的fuelweb_test.models.nailgun_client.NailgunClient.get_api_version方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。