Esempio n. 1
0
 def install(self, installer_obj=None, cmd_args=None, cmd_kwargs=None):
     """General purpose installer"""
     if not installer_obj:
         command_opts = {'scenario': self.__class__.__name__.lower()}
         command_opts.update(cmd_kwargs)
         installer_obj = InstallerCommand(*cmd_args, **command_opts)
     return self.execute(installer_obj.get_command())
    def test_post_performance_tuning_apply(self, target_sat):
        """In postupgrade scenario, we verify the set tuning parameters and custom-hiera.yaml
        file's content.

        :id: postupgrade-31e26b08-2157-11ea-9223-001a4a1601d8

        :steps:
            1. Check the tuning size.
            2. Compare the custom-hiera.yaml file.
            3. Change the tuning size from medium to default.

        :expectedresults:
            1. medium tune parameter should be unchanged after upgrade.
            2. custom-hiera.yaml file should be unchanged after upgrade.
            3. tuning parameter update should work after upgrade.

        """
        installer_obj = InstallerCommand(help='tuning')
        command_output = target_sat.execute(installer_obj.get_command(),
                                            timeout='30m')
        assert 'default: "medium"' in command_output.stdout
        target_sat.get(
            local_path="custom-hiera-after-upgrade.yaml",
            remote_path="/etc/foreman-installer/custom-hiera.yaml",
        )
        assert filecmp.cmp('custom-hiera-before-upgrade.yaml',
                           'custom-hiera-after-upgrade.yaml')
        installer_obj = InstallerCommand(tuning='default')
        command_output = target_sat.execute(installer_obj.get_command(),
                                            timeout='30m')
        assert 'Success!' in command_output.stdout
        installer_obj = InstallerCommand(help='tuning')
        command_output = target_sat.execute(installer_obj.get_command())
        assert 'default: "default"' in command_output.stdout
    def test_pre_performance_tuning_apply(self, target_sat):
        """In preupgrade scenario we apply the medium tuning size.

        :id: preupgrade-83404326-20b7-11ea-a370-48f17f1fc2e1

        :steps:
            1. collect the custom_hira.yaml file before upgrade.
            2. Update the tuning size to medium.
            3. Check the updated tuning size.
            4. If something gets wrong with updated tune size then restore the default tune size.

        :expectedresults: Medium tuning parameter should be applied.

        """
        try:
            target_sat.get(
                local_path="custom-hiera-before-upgrade.yaml",
                remote_path="/etc/foreman-installer/custom-hiera.yaml",
            )
            installer_obj = InstallerCommand(tuning='medium')
            command_output = target_sat.execute(installer_obj.get_command(),
                                                timeout='30m')
            assert 'Success!' in command_output.stdout
            installer_obj = InstallerCommand(help='tuning')
            command_output = target_sat.execute(installer_obj.get_command())
            assert 'default: "medium"' in command_output.stdout

        except Exception as exp:
            logger.critical(exp)
            installer_obj = InstallerCommand(tuning='default')
            command_output = target_sat.execute(installer_obj.get_command(),
                                                timeout='30m')
            assert 'Success!' in command_output.stdout
            assert 'default: "default"' in command_output.stdout
            raise
Esempio n. 4
0
 def capsule_certs_generate(self, capsule, **extra_kwargs):
     """Generate capsule certs, returning the cert path and the installer command args"""
     command = InstallerCommand(
         command='capsule-certs-generate',
         foreman_proxy_fqdn=capsule.hostname,
         certs_tar=f'/root/{capsule.hostname}-certs.tar',
         **extra_kwargs,
     )
     result = self.execute(command.get_command())
     install_cmd = InstallerCommand.from_cmd_str(cmd_str=result.stdout)
     install_cmd.opts['certs-tar-file'] = f'/root/{capsule.hostname}-certs.tar'
     return install_cmd
Esempio n. 5
0
def sat_with_katello_agent(module_destructive_sat):
    """Enable katello-agent on destructive_sat"""
    module_destructive_sat.register_to_dogfood()
    # Enable katello-agent from satellite-installer
    result = module_destructive_sat.install(
        InstallerCommand('foreman-proxy-content-enable-katello-agent true'))
    assert result.status == 0
    # Verify katello-agent is enabled
    result = module_destructive_sat.install(
        InstallerCommand(
            help='| grep foreman-proxy-content-enable-katello-agent'))
    assert 'true' in result.stdout
    yield module_destructive_sat
Esempio n. 6
0
def test_plugin_installation(destructive_sat, command_args, command_opts,
                             rpm_command):
    """Check that external DNS and DHCP plugins install correctly

    :id: c75aa5f3-870a-4f4a-9d7a-0a871b47fd6f

    :Steps: Run installer with mininum options required to install plugins

    :expectedresults: Plugins install successfully

    :CaseAutomation: Automated

    :customerscenario: true

    :BZ: 1994490, 2000237
    """
    register_satellite(destructive_sat)
    installer_obj = InstallerCommand(command_args, **command_opts)
    command_output = destructive_sat.execute(installer_obj.get_command())
    assert 'Success!' in command_output.stdout
    rpm_result = destructive_sat.execute(rpm_command)
    assert rpm_result.status == 0
Esempio n. 7
0
    'puppet-server': 'true',
    'puppet-server-foreman-ssl-ca':
    '/etc/pki/katello/puppet/puppet_client_ca.crt',
    'puppet-server-foreman-ssl-cert':
    '/etc/pki/katello/puppet/puppet_client.crt',
    'puppet-server-foreman-ssl-key':
    '/etc/pki/katello/puppet/puppet_client.key',
    # Options for puppetbootstrap test
    'foreman-proxy-templates': 'true',
    'foreman-proxy-http': 'true',
}

enable_satellite_cmd = InstallerCommand(
    installer_args=[
        'enable-foreman-plugin-puppet',
        'enable-foreman-cli-puppet',
        'enable-puppet',
    ],
    installer_opts=common_opts,
)

enable_capsule_cmd = InstallerCommand(
    installer_args=[
        'enable-puppet',
    ],
    installer_opts=common_opts,
)


@pytest.fixture(scope='session')
def session_puppet_enabled_sat(session_satellite_host):
    """Satellite with enabled puppet plugin"""