def test_v2(): script = scripts.load_script("v2") assert script is not None eq_("v2", script["name"]) assert len(script["shortdesc"]) > 0 actions = scripts.verify( script, { "id": "www", "apache": {"id": "apache"}, "virtual-ip": {"id": "www-vip", "ip": "192.168.1.100"}, "install": False, }, external_check=False, ) pprint(actions) eq_(len(actions), 1) assert str(actions[0]["text"]).find("group www") >= 0 actions = scripts.verify( script, { "id": "www", "apache": {"id": "apache"}, "virtual-ip": {"id": "www-vip", "ip": "192.168.1.100"}, "install": True, }, external_check=False, ) pprint(actions) eq_(len(actions), 3)
def test_agent_include(): inc2 = scripts.load_script("inc2") actions = scripts.verify( inc2, {"wiz": "abc", "foo": "cde", "included-script": {"foo": True, "bar": "bah bah"}}, external_check=False ) pprint(actions) eq_(len(actions), 6) eq_("33\n\nabc", actions[-1]["text"].strip())
def test_vipinc(): script = scripts.load_script("vipinc") assert script is not None actions = scripts.verify(script, {"vip": {"id": "vop", "ip": "10.0.0.4"}}, external_check=False) eq_(len(actions), 1) pprint(actions) assert actions[0]["text"].find('primitive vop test:virtual-ip\n\tip="10.0.0.4"') >= 0 assert actions[0]["text"].find("clone c-vop vop") >= 0
def test_unified(): unified = scripts.load_script('unified') actions = scripts.verify( unified, {'id': 'foo', 'vip': {'id': 'bar', 'ip': '192.168.0.15'}}, external_check=False) pprint(actions) eq_(len(actions), 1) eq_('primitive bar IPaddr2 ip=192.168.0.15\ngroup g-foo foo bar', actions[-1]['text'].strip())
def test_unified(): unified = scripts.load_script('unified') actions = scripts.verify( unified, {'id': 'foo', 'vip': {'id': 'bar', 'ip': '192.168.0.15'}}, external_check=False) pprint(actions) eq_(len(actions), 1) eq_('primitive bar IPaddr2 ip=192.168.0.15\ngroup g-foo foo bar', actions[-1]['text'].strip())
def test_vipinc(): script = scripts.load_script('vipinc') assert script is not None actions = scripts.verify( script, {'vip': {'id': 'vop', 'ip': '10.0.0.4'}}) eq_(len(actions), 1) pprint(actions) assert actions[0]['text'].find('primitive vop test:virtual-ip\n\tip="10.0.0.4"') >= 0 assert actions[0]['text'].find("clone c-vop vop") >= 0
def test_vipinc(): script = scripts.load_script('vipinc') assert script is not None actions = scripts.verify( script, {'vip': {'id': 'vop', 'ip': '10.0.0.4'}}, external_check=False) eq_(len(actions), 1) pprint(actions) assert actions[0]['text'].find('primitive vop test:virtual-ip\n\tip="10.0.0.4"') >= 0 assert actions[0]['text'].find("clone c-vop vop") >= 0
def test_agent_include(): inc2 = scripts.load_script('inc2') actions = scripts.verify( inc2, {'wiz': 'abc', 'foo': 'cde', 'included-script': {'foo': True, 'bar': 'bah bah'}}) pprint(actions) eq_(len(actions), 6) eq_('33\n\nabc', actions[-1]['text'].strip())
def test_agent_include(): inc2 = scripts.load_script('inc2') actions = scripts.verify( inc2, {'wiz': 'abc', 'foo': 'cde', 'included-script': {'foo': True, 'bar': 'bah bah'}}, external_check=False) pprint(actions) eq_(len(actions), 6) eq_('33\n\nabc', actions[-1]['text'].strip())
def test_load_legacy(): script = scripts.load_script('legacy') assert script is not None eq_('legacy', script['name']) assert len(script['shortdesc']) > 0 pprint(script) actions = scripts.verify(script, {}, external_check=False) pprint(actions) eq_([{ 'longdesc': '', 'name': 'apply_local', 'shortdesc': 'Configure SSH', 'text': '', 'value': 'configure.py ssh' }, { 'longdesc': '', 'name': 'collect', 'shortdesc': 'Check state of nodes', 'text': '', 'value': 'collect.py' }, { 'longdesc': '', 'name': 'validate', 'shortdesc': 'Verify parameters', 'text': '', 'value': 'verify.py' }, { 'longdesc': '', 'name': 'apply', 'shortdesc': 'Install packages', 'text': '', 'value': 'configure.py install' }, { 'longdesc': '', 'name': 'apply_local', 'shortdesc': 'Generate corosync authkey', 'text': '', 'value': 'authkey.py' }, { 'longdesc': '', 'name': 'apply', 'shortdesc': 'Configure cluster nodes', 'text': '', 'value': 'configure.py corosync' }, { 'longdesc': '', 'name': 'apply_local', 'shortdesc': 'Initialize cluster', 'text': '', 'value': 'init.py' }], actions)
def test_load_legacy(): script = scripts.load_script("legacy") assert script is not None eq_("legacy", script["name"]) assert len(script["shortdesc"]) > 0 pprint(script) actions = scripts.verify(script, {}, external_check=False) pprint(actions) eq_( [ { "longdesc": "", "name": "apply_local", "shortdesc": "Configure SSH", "text": "", "value": "configure.py ssh", }, {"longdesc": "", "name": "collect", "shortdesc": "Check state of nodes", "text": "", "value": "collect.py"}, {"longdesc": "", "name": "validate", "shortdesc": "Verify parameters", "text": "", "value": "verify.py"}, { "longdesc": "", "name": "apply", "shortdesc": "Install packages", "text": "", "value": "configure.py install", }, { "longdesc": "", "name": "apply_local", "shortdesc": "Generate corosync authkey", "text": "", "value": "authkey.py", }, { "longdesc": "", "name": "apply", "shortdesc": "Configure cluster nodes", "text": "", "value": "configure.py corosync", }, {"longdesc": "", "name": "apply_local", "shortdesc": "Initialize cluster", "text": "", "value": "init.py"}, ], actions, )
def test_load_legacy(): script = scripts.load_script('legacy') assert script is not None eq_('legacy', script['name']) assert len(script['shortdesc']) > 0 pprint(script) actions = scripts.verify(script, {}) pprint(actions) eq_([{'longdesc': '', 'name': 'apply_local', 'shortdesc': 'Configure SSH', 'text': '', 'value': 'configure.py ssh'}, {'longdesc': '', 'name': 'collect', 'shortdesc': 'Check state of nodes', 'text': '', 'value': 'collect.py'}, {'longdesc': '', 'name': 'validate', 'shortdesc': 'Verify parameters', 'text': '', 'value': 'verify.py'}, {'longdesc': '', 'name': 'apply', 'shortdesc': 'Install packages', 'text': '', 'value': 'configure.py install'}, {'longdesc': '', 'name': 'apply_local', 'shortdesc': 'Generate corosync authkey', 'text': '', 'value': 'authkey.py'}, {'longdesc': '', 'name': 'apply', 'shortdesc': 'Configure cluster nodes', 'text': '', 'value': 'configure.py corosync'}, {'longdesc': '', 'name': 'apply_local', 'shortdesc': 'Initialize cluster', 'text': '', 'value': 'init.py'}], actions)
def test_v2(): script = scripts.load_script('v2') assert script is not None eq_('v2', script['name']) assert len(script['shortdesc']) > 0 actions = scripts.verify( script, {'id': 'www', 'apache': {'id': 'apache'}, 'virtual-ip': {'id': 'www-vip', 'ip': '192.168.1.100'}, 'install': False}, external_check=False) pprint(actions) eq_(len(actions), 1) assert str(actions[0]['text']).find('group www') >= 0 actions = scripts.verify( script, {'id': 'www', 'apache': {'id': 'apache'}, 'virtual-ip': {'id': 'www-vip', 'ip': '192.168.1.100'}, 'install': True}, external_check=False) pprint(actions) eq_(len(actions), 3)
def test_v2(): script = scripts.load_script('v2') assert script is not None eq_('v2', script['name']) assert len(script['shortdesc']) > 0 actions = scripts.verify( script, {'id': 'www', 'apache': {'id': 'apache'}, 'virtual-ip': {'id': 'www-vip', 'ip': '192.168.1.100'}, 'install': False}) pprint(actions) eq_(len(actions), 1) assert str(actions[0]['text']).find('group www') >= 0 actions = scripts.verify( script, {'id': 'www', 'apache': {'id': 'apache'}, 'virtual-ip': {'id': 'www-vip', 'ip': '192.168.1.100'}, 'install': True}) pprint(actions) eq_(len(actions), 3)
def test_load_workflow(): script = scripts.load_script('10-webserver') assert script is not None eq_('10-webserver', script['name']) assert len(script['shortdesc']) > 0
def test_load_workflow(): script = scripts.load_script("10-webserver") assert script is not None eq_("10-webserver", script["name"]) assert len(script["shortdesc"]) > 0
def test_load_workflow(): script = scripts.load_script('10-webserver') assert script is not None eq_('10-webserver', script['name']) assert len(script['shortdesc']) > 0
def test_unified(): unified = scripts.load_script("unified") actions = scripts.verify(unified, {"id": "foo", "vip": {"id": "bar", "ip": "192.168.0.15"}}, external_check=False) pprint(actions) eq_(len(actions), 1) eq_("primitive bar IPaddr2 ip=192.168.0.15\ngroup g-foo foo bar", actions[-1]["text"].strip())