Skip to content

Commit

Permalink
Closed loop BZ#2243679
Browse files Browse the repository at this point in the history
Signed-off-by: Shubham Ganar <sganar@redhat.com>
  • Loading branch information
shubhamsg199 committed Oct 27, 2023
1 parent 4c43843 commit 408ab61
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions tests/foreman/api/test_provisioningtemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,3 +561,70 @@ def test_positive_template_check_aap_snippet(
assert 'systemctl enable ansible-callback' in render
assert f'"host_config_key":"{config_key}"' in render
assert '{"package_install": "zsh"}' in render

@pytest.mark.parametrize('module_sync_kickstart_content', [7, 8, 9], indirect=True)
def test_positive_template_check_remote_execution_snippet(
self,
module_sync_kickstart_content,
module_target_sat,
module_provisioning_capsule,
module_sca_manifest_org,
module_location,
module_default_org_view,
module_lce_library,
default_architecture,
default_partitiontable,
):
"""Read the remote_execution_ssh_keys snippet and verify the home directory permissions are properly set.
:id: e5212c46-d269-4bce-8e03-9d00c086e69e
:expectedresults: The rendered remote_execution_ssh_keys snippet contains correct home directory permissions.
:BZ: 2243679
:customerscenario: true
:parametrized: yes
"""
macaddress = gen_mac(multicast=False)
remote_execution_user = gen_string('alpha')
host = module_target_sat.api.Host(
organization=module_sca_manifest_org,
location=module_location,
name=gen_string('alpha').lower(),
mac=macaddress,
operatingsystem=module_sync_kickstart_content.os,
architecture=default_architecture,
domain=module_sync_kickstart_content.domain,
root_pass=settings.provisioning.host_root_password,
ptable=default_partitiontable,
content_facet_attributes={
'content_source_id': module_provisioning_capsule.id,
'content_view_id': module_default_org_view.id,
'lifecycle_environment_id': module_lce_library.id,
},
host_parameters_attributes=[
{
'name': 'remote_execution_ssh_user',
'value': f'{remote_execution_user}',
'parameter_type': 'string',
},
{
'name': 'remote_execution_create_user',
'value': 'true',
'parameter_type': 'boolean',
},
],
).create()
remote_execution_snippet = host.read_template(data={'template_kind': 'provision'})[
'template'
]
assert (
f'chown -R {remote_execution_user}: ~{remote_execution_user}'
in remote_execution_snippet
)
assert (
f'chown -R {remote_execution_user}: ~{remote_execution_user}/.ssh'
in remote_execution_snippet
)

0 comments on commit 408ab61

Please sign in to comment.