~adam-collard/landscape-charm/install-sources-keys

« back to all changes in this revision

Viewing changes to lib/debconf.py

  • Committer: Free Ekanayaka
  • Date: 2015-10-14 21:11:44 UTC
  • mto: This revision was merged to the branch mainline in revision 333.
  • Revision ID: free.ekanayaka@canonical.com-20151014211144-5cr30ya1wd2uhct2
Set DEBIAN_FRONTEND

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
 
35
35
    def reconfigure(self):
36
36
        """Reconfigure the package in non-interactive mode."""
 
37
        env = os.environ.copy()
 
38
 
37
39
        # XXX It seems that some packages (e.g. postfix) are not happy with
38
40
        #     the 'noninteractive' frontend, and don't really reconfigure
39
41
        #     anything in that case. Using the editor frontend and pointing
40
42
        #     the editor to a no-op like /bin/true workarounds the problem.
41
 
        env = os.environ.copy()
42
43
        env["EDITOR"] = "/bin/true"
43
 
        self._subprocess.check_call([
44
 
            DPKG_RECONFIGURE, "-feditor", self._package], env=env)
 
44
 
 
45
        # XXX Set the frontend using the environment variable and not the -f
 
46
        #     command line options, since dpkg-reconfigure prefers the former
 
47
        #     over the latter, and juju sets it to noninteractive by default.
 
48
        env["DEBIAN_FRONTEND"] = "editor"
 
49
 
 
50
        self._subprocess.check_call([DPKG_RECONFIGURE, self._package], env=env)
45
51
 
46
52
    def _format_option(self, name, value):
47
53
        """Format an option line to feed to debconf-set-selections."""