Example #1
0
def test_positive_sync_plan_with_hammer_defaults(setup_for_hammer_defaults,
                                                 ansible_module):
    """Verify that sync plan is disabled and enabled
    with hammer defaults set.

    :id: b25734c8-470f-4cad-bc56-5c0f75aa7499

    :setup:
        1. foreman-maintain should be installed.

    :steps:
        1. Setup hammer on system with defaults set

        2. Run foreman-maintain advanced procedure run sync-plans-enable

    :expectedresults: sync plans should get disabled and enabled.

    :CaseImportance: Critical
    """
    contacted = ansible_module.command(Advanced.run_sync_plans_disable())
    for result in contacted.values():
        logger.info(result["stdout"])
        assert "FAIL" not in result["stdout"]
        assert result["rc"] == 0
    contacted = ansible_module.command(Advanced.run_sync_plans_enable())
    for result in contacted.values():
        logger.info(result["stdout"])
        assert "FAIL" not in result["stdout"]
        assert result["rc"] == 0
Example #2
0
def test_positive_sync_plan_with_hammer_defaults(setup_for_hammer_defaults, ansible_module):
    """Verify that sync plan is disabled and enabled
    with hammer defaults set.

    :id: b25734c8-470f-4cad-bc56-5c0f75aa7499

    :setup:
        1. foreman-maintain should be installed.

    :steps:
        1. Setup hammer on system with defaults set

        2. Run foreman-maintain advanced procedure run sync-plans-enable

    :expectedresults: sync plans should get disabled and enabled.

    :CaseImportance: Critical
    """
    contacted = ansible_module.command(Advanced.run_sync_plans_disable())
    for result in contacted.values():
        logger.info(result['stdout'])
        assert "FAIL" not in result['stdout']
        assert result['rc'] == 0
    contacted = ansible_module.command(Advanced.run_sync_plans_enable())
    for result in contacted.values():
        logger.info(result['stdout'])
        assert "FAIL" not in result['stdout']
        assert result['rc'] == 0
Example #3
0
def test_positive_sync_plan_disable_enable(setup_sync_plan, ansible_module):
    """Run sync-plans-enable and sync-plans-disable
    using advanced procedure run.

    :id: 865df1e1-1189-437c-8451-22d772ff97d4

    :setup:
        1. foreman-maintain should be installed.

    :steps:
        1. Run foreman-maintain advanced procedure run
        sync-plans-disable
        2. Run foreman-maintain advanced procedure run
        sync-plans-enable

    :expectedresults: procedure sync-plans-enable should work.

    :CaseImportance: Critical
    """
    sync_ids, sat_hostname = setup_sync_plan()
    contacted = ansible_module.command(Advanced.run_sync_plans_disable())
    for result in contacted.values():
        logger.info(result["stdout"])
        assert result["rc"] == 0
        assert "FAIL" not in result["stdout"]
    ansible_module.fetch(src="/var/lib/foreman-maintain/data.yml", dest="./")
    with open("./{}/var/lib/foreman-maintain/data.yml".format(
            sat_hostname)) as f:
        data_yml = yaml.safe_load(f)
    assert len(sync_ids) == len(
        data_yml[":default"][":sync_plans"][":disabled"])
    assert sorted(sync_ids) == sorted(
        data_yml[":default"][":sync_plans"][":disabled"])

    contacted = ansible_module.command(Advanced.run_sync_plans_enable())
    for result in contacted.values():
        logger.info(result["stdout"])
        assert result["rc"] == 0
        assert "FAIL" not in result["stdout"]
    ansible_module.fetch(src="/var/lib/foreman-maintain/data.yml", dest="./")
    with open("./{}/var/lib/foreman-maintain/data.yml".format(
            sat_hostname)) as f:
        data_yml = yaml.safe_load(f)
    assert len(sync_ids) == len(
        data_yml[":default"][":sync_plans"][":enabled"])
    assert sorted(sync_ids) == sorted(
        data_yml[":default"][":sync_plans"][":enabled"])
Example #4
0
def test_positive_sync_plan_disable_enable(setup_sync_plan, ansible_module):
    """Run sync-plans-enable and sync-plans-disable
    using advanced procedure run.

    :id: 865df1e1-1189-437c-8451-22d772ff97d4

    :setup:
        1. foreman-maintain should be installed.

    :steps:
        1. Run foreman-maintain advanced procedure run
        sync-plans-disable
        2. Run foreman-maintain advanced procedure run
        sync-plans-enable

    :expectedresults: procedure sync-plans-enable should work.

    :CaseImportance: Critical
    """
    sat_hostname = ''
    for facts in ansible_module.setup().items():
        sat_hostname = facts[0]
    contacted = ansible_module.command(Advanced.run_sync_plans_disable())
    for result in contacted.values():
        logger.info(result['stdout'])
        assert result["rc"] == 0
        assert "FAIL" not in result['stdout']
    ansible_module.fetch(
        src="/var/lib/foreman-maintain/data.yml",
        dest="./"
    )
    with open('./{0}/var/lib/foreman-maintain/data.yml'.format(sat_hostname)) as f:
        data_yml = yaml.safe_load(f)
    assert setup_sync_plan in data_yml[':default'][':sync_plans'][':disabled']

    contacted = ansible_module.command(Advanced.run_sync_plans_enable())
    for result in contacted.values():
        logger.info(result['stdout'])
        assert result["rc"] == 0
        assert "FAIL" not in result['stdout']
    ansible_module.fetch(
        src="/var/lib/foreman-maintain/data.yml",
        dest="./"
    )
    with open('./{0}/var/lib/foreman-maintain/data.yml'.format(sat_hostname)) as f:
        data_yml = yaml.safe_load(f)
    assert setup_sync_plan in data_yml[':default'][':sync_plans'][':enabled']
Example #5
0
def test_positive_sync_plan_disable(ansible_module):
    """Run sync-plans-disable using advanced procedure run

    :id: 8690d875-6784-41f3-92cc-06e2bc8b5dc0

    :setup:
        1. foreman-maintain should be installed.

    :steps:
        1. Run foreman-maintain advanced procedure run
        sync-plans-disable

    :expectedresults: procedure sync-plans-disable should work.

    :CaseImportance: Critical
    """
    contacted = ansible_module.command(Advanced.run_sync_plans_disable())
    for result in contacted.values():
        logger.info(result['stdout'])
        assert "FAIL" not in result['stdout']