Example #1
0
def get_admin_ip(env):
    msg = ('get_admin_ip has been deprecated in favor of '
           'DevopsEnvironment.get_admin_ip')
    logger.warning(msg)
    warnings.warn(msg, DeprecationWarning)

    from devops import client
    denv = client.DevopsClient().get_env(env.name)
    return denv.get_admin_ip()
Example #2
0
    def __init__(self, args):
        self.args = args
        self.params = self.get_params()
        self.client = client.DevopsClient()
        self.env = None

        name = getattr(self.params, 'name', None)
        command = getattr(self.params, 'command', None)

        if name and command != 'create':
            self.env = self.client.get_env(name)
Example #3
0
def get_slave_ip(env, node_mac_address):
    msg = ('get_slave_ip has been deprecated in favor of '
           'DevopsEnvironment.get_node_ip')
    logger.warning(msg)
    warnings.warn(msg, DeprecationWarning)

    from devops import client
    from devops.client import nailgun
    denv = client.DevopsClient().get_env(env.name)
    ng_client = nailgun.NailgunClient(ip=denv.get_admin_ip())
    return ng_client.get_slave_ip_by_mac(node_mac_address)
Example #4
0
def get_admin_remote(env,
                     login=settings.SSH_CREDENTIALS['login'],
                     password=settings.SSH_CREDENTIALS['password']):
    msg = ('get_admin_remote has been deprecated in favor of '
           'DevopsEnvironment.get_admin_remote')
    logger.warning(msg)
    warnings.warn(msg, DeprecationWarning)

    from devops import client
    denv = client.DevopsClient().get_env(env.name)
    return denv.get_admin_remote(login=login, password=password)
Example #5
0
def sync_time(env, node_names, skip_sync=False):
    """Synchronize time on nodes

       param: env - environment object
       param: node_names - list of devops node names
       param: skip_sync - only get the current time without sync
       return: dict{node_name: node_time, ...}
    """
    logger.warning('sync_time is deprecated. Use DevopsClient instead')
    warnings.warn(
        'sync_time is deprecated. Use DevopsClient.sync_time instead',
        DeprecationWarning)

    from devops import client
    denv = client.DevopsClient().get_env(env.name)
    return denv.sync_time(node_names=node_names, skip_sync=skip_sync)
Example #6
0
    def get_ssh_to_remote(self,
                          ip,
                          login=settings.SSH_SLAVE_CREDENTIALS['login'],
                          password=settings.SSH_SLAVE_CREDENTIALS['password']):
        msg = ('get_ssh_to_remote has been deprecated in favor of '
               'DevopsEnvironment.get_node_remote')
        logger.warning(msg)
        warnings.warn(msg, DeprecationWarning)

        from devops import client
        env = client.DevopsClient().get_env(self.name)
        return ssh_client.SSHClient(ip,
                                    auth=ssh_client.SSHAuth(
                                        username=login,
                                        password=password,
                                        keys=env.get_private_keys()))
Example #7
0
    def describe_environment(cls, boot_from='cdrom'):
        """This method is DEPRECATED.

           Reserved for backward compatibility only.
           Please use self.create_environment() instead.
        """
        warnings.warn(
            'describe_environment is deprecated in favor of '
            'DevopsClient.create_env_from_config', DeprecationWarning)

        from devops import client
        dclient = client.DevopsClient()

        template = settings.DEVOPS_SETTINGS_TEMPLATE
        if template:
            return dclient.create_env_from_config(template)
        else:
            return dclient.create_env()