def test_create_master_inv_with_dump_layout(inv_host): inv = Inventory(inv_host.config, 'm6fmviqq51', inv_dump=""" [example] 10.0.154.237 hostname=10.0.154.237 ansible_ssh_private_key_file=/tmp/demo [all] 10.0.154.237 hostname=10.0.154.237 ansible_ssh_private_key_file=/tmp/demo """) inv.create_master(all_hosts=[]) for i in glob.glob('/tmp/inventory/master-*'): with open(i) as f: data = f.read() assert data.find('example') != -1 inv.delete_master()
def test_static_dir_delete_master_inv(inv_host): inv = Inventory(inv_host.config, 'm6fmviqq51') inv.delete_master() assert not os.path.exists('/tmp/inventory/master-m6fmviqq51')
def test_static_dir_delete_master_inv(inv_host): #inv = Inventory(inv_host.config['RESULTS_FOLDER'], inv_host.config['INVENTORY_FOLDER'], 'm6fmviqq51') inv = Inventory(inv_host.config, 'm6fmviqq51') inv.delete_master() assert not os.path.exists('/tmp/inventory/master-m6fmviqq51')