def post_init(self, custom_args=None): """ Post initialization method Store custom apt-get arguments and create runtime configuration and environment :param list custom_args: apt-get arguments """ self.custom_args = custom_args self.exclude_docs = False self.signing_keys = [] if not custom_args: self.custom_args = [] # extract custom arguments used for apt config only if 'exclude_docs' in self.custom_args: self.custom_args.remove('exclude_docs') self.exclude_docs = True if 'check_signatures' in self.custom_args: self.custom_args.remove('check_signatures') self.unauthenticated = 'false' else: self.unauthenticated = 'true' self.distribution = None self.distribution_path = None self.debootstrap_repo_set = False self.repo_names = [] self.components = [] # apt-get support is based on creating a sources file which # contains path names to the repo and its cache. In order to # allow a persistent use of the files in and outside of a chroot # call an active bind mount from RootBind::mount_shared_directory # is expected and required self.manager_base = self.shared_location + '/apt-get' self.shared_apt_get_dir = { 'sources-dir': self.manager_base + '/sources.list.d', 'preferences-dir': self.manager_base + '/preferences.d' } self.keyring = '{}/trusted.gpg'.format(self.manager_base) self.runtime_apt_get_config_file = NamedTemporaryFile( dir=self.root_dir) self.apt_get_args = [ '-q', '-c', self.runtime_apt_get_config_file.name, '-y' ] + self.custom_args self.command_env = self._create_apt_get_runtime_environment() # config file for apt-get tool self.apt_conf = PackageManagerTemplateAptGet() self._write_runtime_config()
def setup(self): self.apt = PackageManagerTemplateAptGet()