Exemplo n.º 1
0
 def restore(self):
     # NOTE(akscram): Ubuntu systems created in the 7.0 release
     # use the 'bootstrap' profile that was removed since 9.0.
     with cobbler.rename_bootstrap_profile_for_systems():
         super(CobblerArchivator, self).restore()
         subprocess.call(["systemctl", "stop", "cobblerd"])
         puppet.apply_task("cobbler")
Exemplo n.º 2
0
    def restore(self):
        dump = self.archive.extractfile(self.filename)
        subprocess.call(["systemctl", "stop"] + self.services)
        subprocess.call(["sudo", "-u", "postgres", "dropdb", "--if-exists",
                         self.db])
        with subprocess.popen(["sudo", "-u", "postgres", "psql"],
                              stdin=subprocess.PIPE) as process:
            shutil.copyfileobj(dump, process.stdin)

        puppet.apply_task(self.db)
Exemplo n.º 3
0
def test_apply_task(mock_subprocess, name, returncode, is_error):
    filename = "/etc/puppet/modules/fuel/examples/{0}.pp".format(name)
    cmd = ['puppet', 'apply', '-d', '-v', "--color", "false",
           '--detailed-exitcodes', filename]
    if is_error:
        mock_subprocess.side_effect = \
            subprocess.CalledProcessError(returncode, 'CMD')
        with pytest.raises(subprocess.CalledProcessError):
            puppet_util.apply_task(name)
    else:
        puppet_util.apply_task(name)
    mock_subprocess.assert_called_once_with(cmd)
Exemplo n.º 4
0
 def _post_restore_action(self):
     for task in ["hiera", "host"]:
         puppet.apply_task(task)
Exemplo n.º 5
0
 def restore(self):
     networks_member = next(archivate.filter_members(
         self.archive, self.backup_name), None)
     if networks_member is not None:
         super(AdminNetworks, self).restore()
         puppet.apply_task("dhcp-ranges")
Exemplo n.º 6
0
 def restore(self):
     puppet.apply_task("postgresql")
     super(DatabasesArchivator, self).restore()