Пример #1
0
 def _bg_run_uu(self):
     target_tmp = os.path.join(self.model.target, "tmp")
     os.makedirs(target_tmp, exist_ok=True)
     apt_conf = tempfile.NamedTemporaryFile(dir=target_tmp,
                                            delete=False,
                                            mode='w')
     apt_conf.write(uu_apt_conf)
     apt_conf.close()
     env = os.environ.copy()
     env["APT_CONFIG"] = apt_conf.name[len(self.model.target):]
     if self.opts.dry_run:
         self.uu = utils.start_command(
             ["sleep", str(10 / self.app.scale_factor)])
         self.uu.wait()
     else:
         self._bg_run_command_logged([
             sys.executable,
             "-m",
             "curtin",
             "in-target",
             "-t",
             "/target",
             "--",
             "unattended-upgrades",
             "-v",
         ],
                                     env=env,
                                     check=True)
     os.remove(apt_conf.name)
Пример #2
0
 def fetch_ssh_keys(self, user_spec, ssh_import_id):
     log.debug("User input: %s, fetching ssh keys for %s",
               user_spec, ssh_import_id)
     self._fetching_proc = utils.start_command(['ssh-import-id', '-o-',
                                                ssh_import_id])
     self.run_in_bg(
         lambda: self._bg_fetch_ssh_keys(user_spec, self._fetching_proc,
                                         ssh_import_id),
         self._fetched_ssh_keys)
Пример #3
0
 def _bg_run_uu(self):
     if self.opts.dry_run:
         self.uu = utils.start_command(
             ["sleep", str(10 / self.scale_factor)])
         self.uu.wait()
     else:
         self._bg_run_command_logged([
             sys.executable,
             "-m",
             "curtin",
             "in-target",
             "-t",
             "/target",
             "--",
             "unattended-upgrades",
             "-v",
         ],
                                     check=True)
Пример #4
0
 def start(self):
     self.proc = start_command(self.cmd)