コード例 #1
0
ファイル: cmdconf.py プロジェクト: anatolii-borysov/dcos
    def __init__(self, **cmd_opts):
        """"""
        self.msg_src = self.__class__.__name__
        super(CmdConfigSetup, self).__init__(**cmd_opts)
        # DC/OS installation storage manager
        self.inst_storage = InstallationStorage(
            root_dpath=cmd_opts.get(CLI_CMDOPT.INST_ROOT),
            cfg_dpath=cmd_opts.get(CLI_CMDOPT.INST_CONF),
            pkgrepo_dpath=cmd_opts.get(CLI_CMDOPT.INST_PKGREPO),
            state_dpath=cmd_opts.get(CLI_CMDOPT.INST_STATE),
            var_dpath=cmd_opts.get(CLI_CMDOPT.INST_VAR),
        )
        LOG.debug(f'{self.msg_src}: istor_nodes:'
                  f' {self.inst_storage.istor_nodes}')
        if cmd_opts.get(CLI_CMDOPT.CMD_TARGET) == CLI_CMDTARGET.PKGALL:
            # Make sure that the installation storage is in consistent state
            self.inst_storage.construct()

        # DC/OS cluster setup parameters
        self.cluster_conf_nop = False
        self.cluster_conf = self.get_cluster_conf()
        LOG.debug(f'{self.msg_src}: cluster_conf: {self.cluster_conf}')

        # Reference list of DC/OS packages
        self.ref_pkg_list = self.get_ref_pkg_list()
        LOG.debug(f'{self.msg_src}: ref_pkg_list: {self.ref_pkg_list}')

        # DC/OS aggregated configuration object
        self.dcos_conf = self.get_dcos_conf()
        LOG.debug(f'{self.msg_src}: dcos_conf: {self.dcos_conf}')
コード例 #2
0
ファイル: cmdconf.py プロジェクト: some-things/dcos
    def __init__(self, **cmd_opts):
        """Constructor."""
        self.msg_src = self.__class__.__name__
        self.cmd_opts = cmd_opts

        # DC/OS installation storage manager
        self.inst_storage = InstallationStorage(
            root_dpath=self.cmd_opts.get(CLI_CMDOPT.INST_ROOT),
            cfg_dpath=self.cmd_opts.get(CLI_CMDOPT.INST_CONF),
            pkgrepo_dpath=self.cmd_opts.get(CLI_CMDOPT.INST_PKGREPO),
            state_dpath=self.cmd_opts.get(CLI_CMDOPT.INST_STATE),
            var_dpath=self.cmd_opts.get(CLI_CMDOPT.INST_VAR),
        )
        LOG.debug(f'{self.msg_src}: istor_nodes:'
                  f' {self.inst_storage.istor_nodes}')
コード例 #3
0
ファイル: cmdconf.py プロジェクト: anatolii-borysov/dcos
    def __init__(self, **cmd_opts):
        """"""
        super(CmdConfigStart, self).__init__(**cmd_opts)
        # Create DC/OS installation storage manager
        self.inst_storage = InstallationStorage(
            root_dpath=cmd_opts.get(CLI_CMDOPT.INST_ROOT),
            cfg_dpath=cmd_opts.get(CLI_CMDOPT.INST_CONF),
            pkgrepo_dpath=cmd_opts.get(CLI_CMDOPT.INST_PKGREPO),
            state_dpath=cmd_opts.get(CLI_CMDOPT.INST_STATE),
            var_dpath=cmd_opts.get(CLI_CMDOPT.INST_VAR))
        LOG.debug(f'{self.__class__.__name__}: inst_storage: istor_nodes:'
                  f' {self.inst_storage.istor_nodes}')
        # Make sure that the installation storage is in consistent state
        self.inst_storage.construct()

        # DC/OS cluster setup parameters
        self.cluster_conf = {}
        LOG.debug(
            f'{self.__class__.__name__}: cluster_conf: {self.cluster_conf}')
コード例 #4
0
 def test_remove_package_error_should_fail(self, mock_rmdir, *args):
     storage = InstallationStorage()
     mock_pkg = mock.Mock()
     mock_pkg.pkg_id = 'test'
     with pytest.raises(RCRemoveError):
         storage.remove_package(mock_pkg)
コード例 #5
0
 def test_remove_package_should_remove_dir(self, mock_rmdir, *args):
     storage = InstallationStorage()
     mock_pkg = mock.Mock()
     mock_pkg.pkg_id = 'test'
     storage.remove_package(mock_pkg)
     mock_rmdir.assert_called_once()
コード例 #6
0
 def test_get_pkgactive_should_call_loader(self, *args):
     storage = InstallationStorage()
     mock_loader = mock.Mock()
     storage.get_pkgactive(mock_loader)
     mock_loader.assert_called_once_with('test_me')
コード例 #7
0
 def test_destruct_should_call_rm_dir(self, rmdir_mock, *args):
     storage = InstallationStorage()
     storage.destruct()
     rmdir_mock.assert_called()
コード例 #8
0
 def test_destruct_rmdir_should_fail(self, *args):
     storage = InstallationStorage()
     with pytest.raises(InstallationStorageError):
         storage.destruct()
コード例 #9
0
 def test_construct_should_mkdir(self, mock_mkdir, *args):
     storage = InstallationStorage()
     storage.construct()
     mock_mkdir.assert_called_with(exist_ok=True, parents=True)