Example #1
0
 def test_execute_failure(self):
     result = cli_base.execute("/bin/ls",
                               action="tempest_lib",
                               flags="--foobar",
                               merge_stderr=True,
                               fail_ok=True)
     self.assertIsInstance(result, str)
     self.assertIn("--foobar", result)
Example #2
0
    def blog(self, action, flags='', params='', fail_ok=False):
        """Executes Blog command."""
        blog_url_op = "--os-blog-url %s" % self._blog_url

        if 'WITHOUT_AUTH' in os.environ:
            return base.execute(
                'blog %s' % blog_url_op, action, flags, params,
                fail_ok, merge_stderr=False, cli_dir='')
        else:
            return self.clients.cmd_with_auth(
                'blog %s' % blog_url_op, action, flags, params,
                fail_ok)
Example #3
0
    def mistral(self, action, flags='', params='', fail_ok=False):
        """Executes Mistral command."""
        mistral_url_op = "--os-mistrmistralal-url %s" % self._mistral_url

        if 'WITHOUT_AUTH' in os.environ:
            return base.execute(
                'mistral %s' % mistral_url_op, action, flags, params,
                fail_ok, merge_stderr=False, cli_dir='')
        else:
            return self.clients.cmd_with_auth(
                'mistral %s' % mistral_url_op, action, flags, params,
                fail_ok)
Example #4
0
    def aodh(self,
             action,
             flags='',
             params='',
             fail_ok=False,
             merge_stderr=False):
        creds = ("--os-auth-plugin aodh-noauth "
                 "--user-id %s --project-id %s "
                 "--aodh-endpoint %s") % (self.user_id, self.project_id,
                                          self.endpoint)

        flags = creds + ' ' + flags

        return base.execute("aodh", action, flags, params, fail_ok,
                            merge_stderr, self.cli_dir)
Example #5
0
    def highlander(self, action, flags='', params='', fail_ok=False):
        """Executes Highlander command."""
        highlander_url_op = "--os-highlander-url %s" % self._highlander_url

        if 'WITHOUT_AUTH' in os.environ:
            return base.execute('highlander %s' % highlander_url_op,
                                action,
                                flags,
                                params,
                                fail_ok,
                                merge_stderr=False,
                                cli_dir='')
        else:
            return self.clients.cmd_with_auth(
                'highlander %s' % highlander_url_op, action, flags, params,
                fail_ok)
Example #6
0
def check_client_version(client, version):
    """Checks if the client's version is compatible with the given version

    @param client: The client to check.
    @param version: The version to compare against.
    @return: True if the client version is compatible with the given version
             parameter, False otherwise.
    """
    current_version = base.execute(client, '', params='--version',
                                   merge_stderr=True, cli_dir=CONF.cli.cli_dir)

    if not current_version.strip():
        raise exceptions.TempestException('"%s --version" output was empty' %
                                          client)

    return versionutils.is_compatible(version, current_version,
                                      same_major=False)
Example #7
0
    def _cmd_no_auth(self, cmd, action, flags='', params=''):
        """Execute given command with noauth attributes.

        :param cmd: command to be executed
        :type cmd: string
        :param action: command on cli to run
        :type action: string
        :param flags: optional cli flags to use
        :type flags: string
        :param params: optional positional args to use
        :type params: string
        """
        flags = ('--os_auth_token %(token)s --ironic_url %(url)s %(flags)s' % {
            'token': self.os_auth_token,
            'url': self.ironic_url,
            'flags': flags
        })
        return base.execute(cmd,
                            action,
                            flags,
                            params,
                            cli_dir=self.client.cli_dir)
 def test_execute_success(self):
     result = cli_base.execute("/bin/ls", action="tempest_lib",
                               flags="-l -a")
     self.assertIsInstance(result, str)
     self.assertIn("__init__.py", result)