Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.12] fixing a forgotten make_job_invocaiton call #13707

Merged
merged 1 commit into from
Jan 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 33 additions & 3 deletions tests/foreman/cli/test_remoteexecution.py
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,6 @@ def test_positive_run_job_on_host_registered_to_pull_provider(
module_ak_with_cv,
module_capsule_configured_mqtt,
rhel_contenthost,
target_sat,
):
"""Run custom template on host registered to mqtt

Expand Down Expand Up @@ -1080,13 +1079,44 @@ def test_positive_run_job_on_host_registered_to_pull_provider(
result = rhel_contenthost.execute('yggdrasil status')
assert result.status == 0, f'Failed to start yggdrasil on client: {result.stderr}'
# run script provider rex command
invocation_command = target_sat.cli_factory.job_invocation(
invocation_command = module_target_sat.cli_factory.job_invocation(
{
'job-template': 'Service Action - Script Default',
'inputs': 'action=status, service=yggdrasild',
'search-query': f"name ~ {rhel_contenthost.hostname}",
}
)
assert_job_invocation_result(
target_sat, invocation_command['id'], rhel_contenthost.hostname
module_target_sat, invocation_command['id'], rhel_contenthost.hostname
)
# create user on host
username = gen_string('alpha')
filename = gen_string('alpha')
make_user_job = module_target_sat.cli_factory.job_invocation(
{
'job-template': 'Run Command - Script Default',
'inputs': f"command=useradd -m {username}",
'search-query': f"name ~ {rhel_contenthost.hostname}",
}
)
assert_job_invocation_result(
module_target_sat, make_user_job['id'], rhel_contenthost.hostname
)
# create a file as new user
invocation_command = module_target_sat.cli_factory.job_invocation(
{
'job-template': 'Run Command - Script Default',
'inputs': f"command=touch /home/{username}/{filename}",
'search-query': f"name ~ {rhel_contenthost.hostname}",
'effective-user': f'{username}',
}
)
assert_job_invocation_result(
module_target_sat, invocation_command['id'], rhel_contenthost.hostname
)
# check the file owner
result = rhel_contenthost.execute(
f'''stat -c '%U' /home/{username}/{filename}''',
)
# assert the file is owned by the effective user
assert username == result.stdout.strip('\n')