From 1018df40b1c80acc953e7effe31290c64732fef9 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Mon, 25 Nov 2024 11:37:48 +0100 Subject: [PATCH 1/3] use sat.put() instead of sat.execute(echo) to place puppet files --- tests/foreman/sys/test_fam.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/foreman/sys/test_fam.py b/tests/foreman/sys/test_fam.py index c6a381c6bf..8e205bad58 100644 --- a/tests/foreman/sys/test_fam.py +++ b/tests/foreman/sys/test_fam.py @@ -118,8 +118,10 @@ def create_fake_module(module_target_sat, module_name, module_classes): module_target_sat.execute(f'mkdir -p {manifest_dir}') for module_class in module_classes: full_class = module_name if module_class == 'init' else f'{module_name}::{module_class}' - module_target_sat.execute( - f'echo "class {full_class}(){{}}" > {manifest_dir}/{module_class}.pp' + module_target_sat.put( + f'class {full_class}(){{}}', + f'{manifest_dir}/{module_class}.pp', + temp_file=True, ) create_fake_module( From 512ce62439fbb7244b1357134fac03792f9c36b7 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Mon, 25 Nov 2024 11:48:09 +0100 Subject: [PATCH 2/3] allow passing in custom module code --- tests/foreman/sys/test_fam.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/foreman/sys/test_fam.py b/tests/foreman/sys/test_fam.py index 8e205bad58..dbd2f76921 100644 --- a/tests/foreman/sys/test_fam.py +++ b/tests/foreman/sys/test_fam.py @@ -117,9 +117,13 @@ def create_fake_module(module_target_sat, module_name, module_classes): manifest_dir = f'{module_dir}/manifests' module_target_sat.execute(f'mkdir -p {manifest_dir}') for module_class in module_classes: + if isinstance(module_class, str): + module_code = '(){}' + else: + module_class, module_code = module_class full_class = module_name if module_class == 'init' else f'{module_name}::{module_class}' module_target_sat.put( - f'class {full_class}(){{}}', + f'class {full_class}{module_code}', f'{manifest_dir}/{module_class}.pp', temp_file=True, ) From 75309d1b5c0658c4e88c2e3cb3d80bbeec310276 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Mon, 25 Nov 2024 11:53:36 +0100 Subject: [PATCH 3/3] create a fake ntp module the one in the repo is too old --- tests/foreman/sys/test_fam.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/tests/foreman/sys/test_fam.py b/tests/foreman/sys/test_fam.py index dbd2f76921..224d66a05b 100644 --- a/tests/foreman/sys/test_fam.py +++ b/tests/foreman/sys/test_fam.py @@ -101,16 +101,6 @@ def setup_fam(module_target_sat, module_sca_manifest, install_import_ansible_rol f'''sed -i 's|subscription_manifest_path:.*|subscription_manifest_path: "data/{module_sca_manifest.name}"|g' {config_file}''' ) - repo_path = '/fake_puppet1/system/releases/p/puppetlabs/' - module_tarball = 'puppetlabs-ntp-3.0.3.tar.gz' - local_path = '/tmp' - module_target_sat.execute( - f'curl --output {local_path}/{module_tarball} {settings.robottelo.repos_hosting_url}{repo_path}{module_tarball}', - ) - module_target_sat.execute( - f'puppet module install --ignore-dependencies {local_path}/{module_tarball}' - ) - def create_fake_module(module_target_sat, module_name, module_classes): base_dir = '/etc/puppetlabs/code/environments/production/modules' module_dir = f'{base_dir}/{module_name}' @@ -128,6 +118,12 @@ def create_fake_module(module_target_sat, module_name, module_classes): temp_file=True, ) + create_fake_module( + module_target_sat, + 'ntp', + [('init', '($logfile, $config_dir, $servers, $burst, $stepout){}'), 'config'], + ) + create_fake_module( module_target_sat, 'prometheus',