예제 #1
0
 def test_manager_deployment_dump(self, remove_deployment=True):
     manager1_original_dir = os.path.join(
         os.path.dirname(__file__),
         'resources', 'storage', 'manager1')
     if not os.path.exists(self.manager_dir):
         shutil.copytree(manager1_original_dir, self.manager_dir)
     result = bootstrap.dump_manager_deployment()
     if remove_deployment:
         shutil.rmtree(self.manager_dir)
         self.assertTrue(
             bootstrap.read_manager_deployment_dump_if_needed(result))
     else:
         self.assertFalse(
             bootstrap.read_manager_deployment_dump_if_needed(result))
     comparison = filecmp.dircmp(manager1_original_dir,
                                 self.manager_dir)
     self.assertIn('dir1', comparison.common)
     self.assertIn('dir2', comparison.common)
     self.assertIn('file1', comparison.common)
     self.assertIn('file2', comparison.common)
     self.assertEqual(comparison.common_funny, [])
     self.assertEqual(comparison.diff_files, [])
     self.assertEqual(comparison.funny_files, [])
     self.assertEqual(comparison.left_only, [])
     self.assertEqual(comparison.right_only, [])
예제 #2
0
 def test_manager_deployment_dump(self, remove_deployment=True):
     manager1_original_dir = self._copy_manager1_dir_to_manager_dir()
     result = bootstrap.dump_manager_deployment()
     if remove_deployment:
         shutil.rmtree(self.manager_dir)
         self.assertTrue(
             bootstrap.read_manager_deployment_dump_if_needed(result))
     else:
         # simulating existing read manager deployment dump - .git folder
         # shouldn't appear there, so removing it alone
         shutil.rmtree(os.path.join(self.manager_dir, '.git'))
         self.assertFalse(
             bootstrap.read_manager_deployment_dump_if_needed(result))
     comparison = filecmp.dircmp(manager1_original_dir,
                                 self.manager_dir)
     self.assertIn('dir1', comparison.common)
     self.assertIn('dir2', comparison.common)
     self.assertIn('file1', comparison.common)
     self.assertIn('file2', comparison.common)
     self.assertEqual([], comparison.common_funny)
     self.assertEqual([], comparison.diff_files)
     self.assertEqual([], comparison.funny_files)
     self.assertEqual([], comparison.right_only)
     # .git folder is ignored when archiving manager deployment, and should
     # not appear in the new manager dir, only in the original one;
     # (however, since in the original dir it's named "dotgit" rather than
     # ".git", we check for that instead - yet neither should be in the
     # manager deployment either way)
     self.assertEqual(['dotgit'], comparison.left_only)
예제 #3
0
파일: tasks.py 프로젝트: wksw/cloudify-cli
def _dump_manager_deployment():
    from cloudify_cli.bootstrap.bootstrap import dump_manager_deployment
    from cloudify_cli.bootstrap.bootstrap import load_env

    # explicitly write the manager node instance id to local storage
    env = load_env('manager')
    with env.storage.payload() as payload:
        payload['manager_node_instance_id'] = ctx.instance.id

    # explicitly flush runtime properties to local storage
    ctx.instance.update()
    return dump_manager_deployment()
예제 #4
0
def _dump_manager_deployment():
    from cloudify_cli.bootstrap.bootstrap import dump_manager_deployment
    from cloudify_cli.bootstrap.bootstrap import load_env

    # explicitly write the manager node instance id to local storage
    env = load_env('manager')
    with env.storage.payload() as payload:
        payload['manager_node_instance_id'] = ctx.instance.id

    # explicitly flush runtime properties to local storage
    ctx.instance.update()
    return dump_manager_deployment()
예제 #5
0
 def test_manager_deployment_dump(self, remove_deployment=True):
     manager1_original_dir = os.path.join(os.path.dirname(__file__),
                                          'resources', 'storage',
                                          'manager1')
     if not os.path.exists(self.manager_dir):
         shutil.copytree(manager1_original_dir, self.manager_dir)
     result = bootstrap.dump_manager_deployment()
     if remove_deployment:
         shutil.rmtree(self.manager_dir)
     self.assertTrue(
         bootstrap.read_manager_deployment_dump_if_needed(result))
     comparison = filecmp.dircmp(manager1_original_dir, self.manager_dir)
     self.assertIn('dir1', comparison.common)
     self.assertIn('dir2', comparison.common)
     self.assertIn('file1', comparison.common)
     self.assertIn('file2', comparison.common)
     self.assertEqual(comparison.common_funny, [])
     self.assertEqual(comparison.diff_files, [])
     self.assertEqual(comparison.funny_files, [])
     self.assertEqual(comparison.left_only, [])
     self.assertEqual(comparison.right_only, [])
예제 #6
0
def _dump_manager_deployment():
    from cloudify_cli.bootstrap.bootstrap import dump_manager_deployment
    # explicitly flush runtime properties to local storage
    ctx.instance.update()
    return dump_manager_deployment()