~ubuntu-core-dev/update-manager/main

« back to all changes in this revision

Viewing changes to DistUpgrade/DistUpgradeController.py

  • Committer: Michael Vogt
  • Date: 2010-11-30 11:38:50 UTC
  • Revision ID: michael.vogt@ubuntu.com-20101130113850-76f5e0f9tcthaeoo
* DistUpgrade/DistUpgradeController.py:
  - when starting a additional sshd detect if there is a firewall
    running and if so print information that the additional sshd
    may need to be added to the firewall rules
* UpdateManager/Core/utils.py:
  - add iptables_active() helper

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
import copy
38
38
import ConfigParser
39
39
from stat import *
40
 
from utils import country_mirror, url_downloadable, check_and_fix_xbit, ExecutionTime, get_arch
 
40
from utils import country_mirror, url_downloadable, check_and_fix_xbit, ExecutionTime, get_arch, iptables_active
41
41
from string import Template
42
42
 
43
43
import DistUpgradeView
252
252
                _("This session appears to be running under ssh. "
253
253
                  "It is not recommended to perform a upgrade "
254
254
                  "over ssh currently because in case of failure "
255
 
                "it is harder to recover.\n\n"
 
255
                  "it is harder to recover.\n\n"
256
256
                  "If you continue, an additional ssh daemon will be "
257
257
                  "started at port '%s'.\n"
258
258
                  "Do you want to continue?") % port)
263
263
                                   "-o", "PidFile=%s" % pidfile,
264
264
                                   "-p",str(port)])
265
265
            if res == 0:
266
 
                self._view.information(
267
 
                    _("Starting additional sshd"),
268
 
                    _("To make recovery in case of failure easier, an "
269
 
                      "additional sshd will be started on port '%s'. "
270
 
                      "If anything goes wrong with the running ssh "
271
 
                      "you can still connect to the additional one.\n"
272
 
                      ) % port)
 
266
                summary = _("Starting additional sshd")
 
267
                descr =  _("To make recovery in case of failure easier, an "
 
268
                           "additional sshd will be started on port '%s'. "
 
269
                           "If anything goes wrong with the running ssh "
 
270
                           "you can still connect to the additional one.\n"
 
271
                           ) % port
 
272
                if iptables_active():
 
273
                    cmd = "iptables -I INPUT -p tcp --dport %s -j ACCEPT" % port
 
274
                    descr += _(
 
275
                        "If you run a firewall, you may need to "
 
276
                        "temporarily open this port. As this is "
 
277
                        "potentially dangerous its not done automatically."
 
278
                        "You can open the port with e.g.:\n'%s'") % cmd
 
279
                self._view.information(summary, descr)
273
280
        return True
274
281
 
275
282
    def _tryUpdateSelf(self):