Exemple #1
0
 def test_save_config(self):
     """Should create tmp_node.json and a nodes/testnode2.json config file"""
     env.host_string = 'testnode2'
     run_list = ["role[testrole]"]
     chef._save_config({"run_list": run_list})
     self.assertTrue(exists(join('nodes', 'testnode2.json')))
     with open(join('nodes','testnode2.json'), 'r') as f:
         data = json.loads(f.read())
         self.assertEquals(data['run_list'], run_list)
     # It should't overwrite existing config files
     env.host_string = 'testnode'# This node exists
     run_list = ["role[testrole]"]
     chef._save_config({"run_list": run_list})
     with open(join('nodes','testnode.json'), 'r') as f:
         data = json.loads(f.read())
         # It should *NOT* have "testrole" assigned
         self.assertEquals(data['run_list'], ["recipe[subversion]"])
Exemple #2
0
 def test_save_config(self):
     """Should create a tmp_node.json and a nodes/testnode2.json config file
     """
     env.host_string = 'testnode2'
     run_list = ["role[testrole]"]
     chef._save_config({"run_list": run_list})
     self.assertTrue(exists(join('nodes', 'testnode2.json')))
     with open(join('nodes', 'testnode2.json'), 'r') as f:
         data = json.loads(f.read())
         self.assertEquals(data['run_list'], run_list)
     # It should't overwrite existing config files
     env.host_string = 'testnode'  # This node exists
     run_list = ["role[testrole]"]
     chef._save_config({"run_list": run_list})
     with open(join('nodes', 'testnode.json'), 'r') as f:
         data = json.loads(f.read())
         # It should *NOT* have "testrole" assigned
         self.assertEquals(data['run_list'], ["recipe[subversion]"])
Exemple #3
0
 def test_save_config(self):
     """Should create tmp_node.json and a nodes/node.json config file"""
     env.host_string = 'testnode'
     chef._save_config({"run_list": ["role[testrole]"]})
     self.assertTrue(os.path.exists(os.path.join('nodes/', 'testnode.json')))