Exemple #1
0
 def check_version(self):
     if self.version < base.OLDEST_SUPPORTED_VERSION:
         raise exceptions.ClientError(
             "Version %s unsupported, must be %s or higher" %
             (utils.version_str(self.version),
              utils.version_str(base.OLDEST_SUPPORTED_VERSION)))
     return
 def check_version(self):
     if self.version < OLDEST_SUPPORTED_VERSION:
         raise exceptions.ClientError(
             "Version %s unsupported, must be %s or higher"
             % (utils.version_str(self.version),
                utils.version_str(OLDEST_SUPPORTED_VERSION)))
     return
 def check_version(self):
     if (self.model_class.min_version > OLDEST_SUPPORTED_VERSION
             and self.client.version < self.model_class.min_version):
         min_version = utils.version_str(self.model_class.min_version)
         curr_version = utils.version_str(self.client.version)
         raise exceptions.ClientError(message="Cannot access %s in version %s, it was added in "
                                              "version %s" % (self.url, curr_version,
                                                              min_version))
 def check_version(self):
     if (self.model_class.min_version > OLDEST_SUPPORTED_VERSION
             and self.client.version < self.model_class.min_version):
         min_version = utils.version_str(self.model_class.min_version)
         curr_version = utils.version_str(self.client.version)
         raise exceptions.ClientError(
             message="Cannot access %s in version %s, it was added in "
             "version %s" % (self.url, curr_version, min_version))
    events.subscribe(models.Host, 'wait', host_done, events.states.FINISHED)

    config = get_default_config()
    config.update(parse_config_file())
    config.update(parse_cli_opts())

    config['validate_ssl'] = not config.pop('no_validate_ssl', False)

    if 'logger' in config:
        log(config.pop('logger'))

    ambari = Ambari(**config)

    try:
        version = ambari.version
    except Exception:  # pylint: disable=broad-except
        traceback.print_exc()
        six.print_("\nCould not connect to Ambari server - aborting!")
        sys.exit(1)

    shell_help = "\n".join([
        "Ambari client available as 'ambari'",
        " - Ambari Server is %s" % ambari.base_url,
        " - Ambari Version is %s\n" % utils.version_str(version),
        " - log(new_level) will reset the logger level",
        " - ambari_ref() will show you all available client method chains",
    ])
    shell = InteractiveShellEmbed(user_ns={'ambari': ambari, 'log': log, 'ambari_ref': reference})
    shell(shell_help)
    sys.exit(0)
Exemple #6
0
def test_version_str(original, expected):
    assert utils.version_str(original) == expected
def test_version_str(original, expected):
    assert utils.version_str(original) == expected
Exemple #8
0
    config.update(parse_cli_opts())

    config['validate_ssl'] = not config.pop('no_validate_ssl', False)

    if 'logger' in config:
        log(config.pop('logger'))

    ambari = Ambari(**config)

    try:
        version = ambari.version
    except Exception:  # pylint: disable=broad-except
        traceback.print_exc()
        six.print_("\nCould not connect to Ambari server - aborting!")
        sys.exit(1)

    shell_help = "\n".join([
        "Ambari client available as 'ambari'",
        " - Ambari Server is %s" % ambari.base_url,
        " - Ambari Version is %s\n" % utils.version_str(version),
        " - log(new_level) will reset the logger level",
        " - ambari_ref() will show you all available client method chains",
    ])
    shell = InteractiveShellEmbed(user_ns={
        'ambari': ambari,
        'log': log,
        'ambari_ref': reference
    })
    shell(shell_help)
    sys.exit(0)