~ubuntu-branches/ubuntu/trusty/unattended-upgrades/trusty

« back to all changes in this revision

Viewing changes to unattended-upgrade

  • Committer: Package Import Robot
  • Author(s): Michael Vogt
  • Date: 2011-12-12 14:01:41 UTC
  • Revision ID: package-import@ubuntu.com-20111212140141-7wr15t1ycq9jchl0
Tags: 0.75.1
* print conffile hold-backs to stdout to ensure its part of
  the cron mail (LP: #773007), thanks to Jean-Baptiste Lallement
* unattended-upgrade:
  - fix crash on automatic-reboot, thanks to Teodor (closes: #651822)
* typo fixes, thanks to Lei Zhang

Show diffs side-by-side

added added

removed removed

Lines of Context:
522
522
        os.dup2(fd,1)
523
523
        os.dup2(fd,2)
524
524
 
525
 
    shutdown_lock = -1
526
525
    try:
527
 
        # lock for the shutdown check - its fine if the system
528
 
        # is shutdown while downloading but not so much while installing
529
 
        shutdown_lock = apt_pkg.get_lock("/var/run/unattended-upgrades.lock")
530
 
 
531
526
        if (options.minimal_upgrade_steps or 
532
527
            apt_pkg.config.find_b("Unattended-Upgrades::MinimalSteps", False)):
533
528
            open("/var/run/unattended-upgrades.pid", "w").write("%s" % os.getpid())
537
532
        else:
538
533
            pkg_install_success = upgrade_normal(
539
534
                cache, [pkg.name for pkg in pkgs_to_upgrade], logfile_dpkg)
540
 
    except Exception, e:
 
535
    except Exception as e:
541
536
        # print unhandled exceptions here this way, while stderr is redirected
542
537
        os.write(old_stderr, "Exception: %s" % e)
543
538
 
734
729
            if not item.is_trusted:
735
730
                blacklisted_pkgs.append(pkgname_from_deb(item.destfile))
736
731
            if conffile_prompt(item.destfile):
737
 
                # FIXME: skip package (means to re-run the whole marking again
 
732
                # skip package (means to re-run the whole marking again
738
733
                # and making sure that the package will not be pulled in by
739
 
                # some other package again!
 
734
                # some other package again!)
 
735
                # 
 
736
                # print to stdout to ensure that this message is part of
 
737
                # the cron mail
 
738
                print _("Package '%s' has conffile prompt and needs to be upgraded manually") % pkgname_from_deb(item.destfile)
 
739
                # log to the logfile
740
740
                logging.warning(_("Package '%s' has conffile prompt and needs to be upgraded manually") % pkgname_from_deb(item.destfile))
741
741
                blacklisted_pkgs.append(pkgname_from_deb(item.destfile))
742
742
                pkgs_kept_back.append(pkgname_from_deb(item.destfile))
799
799
 
800
800
    # only perform install step if we actually have packages to install
801
801
    pkg_install_success = None
 
802
    shutdown_lock = -1
802
803
    if len(pkgs_to_upgrade) > 0:
 
804
        # lock for the shutdown check - its fine if the system
 
805
        # is shutdown while downloading but not so much while installing
 
806
        shutdown_lock = apt_pkg.get_lock("/var/run/unattended-upgrades.lock")
 
807
        # do install
803
808
        pkg_install_success = do_install(cache, pkgs_to_upgrade, options, logfile_dpkg)
804
809
 
805
810
    # send a mail (if needed)