def setup(self): repository = mock.Mock() repository.root_dir = '/root-dir' repository.runtime_config = mock.Mock(return_value={ 'dnf_args': ['-c', '/root-dir/dnf.conf', '-y'], 'command_env': ['env'] }) self.manager = PackageManagerDnf(repository)
def setup(self): repository = mock.Mock() repository.root_dir = 'root-dir' root_bind = mock.Mock() root_bind.move_to_root = mock.Mock( return_value=['root-moved-arguments']) repository.root_bind = root_bind repository.runtime_config = mock.Mock(return_value={ 'dnf_args': ['-c', 'dnf.conf', '-y'], 'command_env': ['env'] }) self.manager = PackageManagerDnf(repository)
def __new__(self, repository, package_manager, custom_args=None): if package_manager == 'zypper': manager = PackageManagerZypper(repository, custom_args) elif package_manager == 'dnf' or package_manager == 'yum': manager = PackageManagerDnf(repository, custom_args) elif package_manager == 'apt-get': manager = PackageManagerApt(repository, custom_args) else: raise KiwiPackageManagerSetupError( 'Support for package manager %s not implemented' % package_manager) log.info('Using package manager backend: %s', package_manager) return manager