robottelo
robottelo copied to clipboard
Host.package_install fails: This action uses katello-agent, which is currently disabled
=================================================== FAILURES ====================================================
_____________________________________ test_positive_generate_hostpkgcompare _____________________________________
local_org = {'compute-resources': {}, 'created-at': '2021/12/01 16:14:08', 'description': {}, 'domains': {}, ...}
local_ak = {'auto-attach': 'true', 'content-view': 'cBnrWEvauS', 'description': {}, 'host-collections': {}, ...}
local_content_view = {'activation-keys': {}, 'components': {}, 'composite': 'false', 'container-image-repositories': {}, ...}
local_environment = {'description': {}, 'id': '33', 'label': 'I28J9H', 'library': 'false', ...}
default_sat = <robottelo.hosts.Satellite object at 0x7f908f670760>
@pytest.mark.tier3
def test_positive_generate_hostpkgcompare(
local_org, local_ak, local_content_view, local_environment, default_sat
):
"""Generate 'Host - compare content hosts packages' report
:id: 572fb387-86f2-40e2-b2df-e8ec26433610
:setup: Installed Satellite with Organization, Activation key,
Content View, Content Host, Subscriptions, and synced fake repo.
:steps:
1. hammer report-template generate --name 'Host - compare content hosts package' ...
:expectedresults: report is scheduled and generated containing all the expected information
regarding host packages
:CaseImportance: Medium
:BZ: 1860430
"""
# Add subscription to Satellite Tools repo to activation key
setup_org_for_a_rh_repo(
{
'product': PRDS['rhel'],
'repository-set': REPOSET['rhst7'],
'repository': REPOS['rhst7']['name'],
'organization-id': local_org['id'],
'content-view-id': local_content_view['id'],
'lifecycle-environment-id': local_environment['id'],
'activationkey-id': local_ak['id'],
}
)
setup_org_for_a_custom_repo(
{
'url': settings.repos.yum_6.url,
'organization-id': local_org['id'],
'content-view-id': local_content_view['id'],
'lifecycle-environment-id': local_environment['id'],
'activationkey-id': local_ak['id'],
}
)
hosts_info = []
with VMBroker(nick='rhel7', host_classes={'host': ContentHost}, _count=2) as hosts:
for client in hosts:
# Create RHEL hosts via broker and register content host
client.install_katello_ca(default_sat)
# Register content host, install katello-agent
client.register_contenthost(local_org['label'], local_ak['name'])
assert client.subscribed
hosts_info.append(Host.info({'name': client.hostname}))
client.enable_repo(REPOS['rhst7']['id'])
client.install_katello_agent()
hosts_info.sort(key=lambda host: host['name'])
host1, host2 = hosts_info
> Host.package_install({'host-id': host1['id'], 'packages': FAKE_0_CUSTOM_PACKAGE_NAME})
tests/foreman/cli/test_reporttemplates.py:916:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
robottelo/cli/host.py:132: in package_install
return cls.execute(cls._construct_command(options), output_format='csv')
robottelo/cli/base.py:253: in execute
return cls._handle_response(response, ignore_stderr=ignore_stderr)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'robottelo.cli.host.Host'>, response = , ignore_stderr = None
@classmethod
def _handle_response(cls, response, ignore_stderr=None):
"""Verify ``status`` of the CLI command.
Check for a non-zero return code or any stderr contents.
:param response: a result object, returned by :mod:`robottelo.ssh.command`.
:param ignore_stderr: indicates whether to throw a warning in logs if
``stderr`` is not empty.
:returns: contents of ``stdout``.
:raises robottelo.cli.base.CLIReturnCodeError: If return code is
different from zero.
"""
if isinstance(response.stderr, tuple):
# the current contents of response.stderr is a tuple with the following properties
# (<len(message)>,<message>).
# This behavior could (and maybe should) change in the near future.
# In the meantime, we don't need it here so we just use the message itself
response.stderr = response.stderr[1]
if isinstance(response.stderr, bytes):
response.stderr = response.stderr.decode()
if response.status != 0:
full_msg = (
f'Command "{cls.command_base} {cls.command_sub}" '
f'finished with status {response.status}\n'
f'stderr contains:\n{response.stderr}'
)
error_data = (response.status, response.stderr, full_msg)
if cls._db_error_regex.search(full_msg):
raise CLIDataBaseError(*error_data)
> raise CLIReturnCodeError(*error_data)
E robottelo.cli.base.CLIReturnCodeError: CLIReturnCodeError(status=128, stderr='This command uses katello agent and will be removed in favor of remote execution in a future release.\nThe remote execution equivalent is `hammer job-invocation create --feature katello_package_install`.\nCould not install packages:\n This action uses katello-agent, which is currently disabled. Use remote execution instead.\n', msg='Command "host package install" finished with status 128\nstderr contains:\nThis command uses katello agent and will be removed in favor of remote execution in a future release.\nThe remote execution equivalent is `hammer job-invocation create --feature katello_package_install`.\nCould not install packages:\n This action uses katello-agent, which is currently disabled. Use remote execution instead.\n'
robottelo/cli/base.py:104: CLIReturnCodeError