Exemple #1
0
 def diff_call(self, diffs):
     self.reboot = diffs.get('Reboot', False)
     if self.reboot is False:
         from freenasOS.Update import GetServiceDescription
         # We may have service changes
         for svc in diffs.get("Restart", []):
             self.restarts.append(GetServiceDescription(svc))
Exemple #2
0
def PrintDifferences(diffs):
    for type in diffs:
        if type == "Packages":
            pkg_diffs = diffs[type]
            for (pkg, op, old) in pkg_diffs:
                if op == "delete":
                    print >> sys.stderr, "Delete package %s" % pkg.Name()
                elif op == "install":
                    print >> sys.stderr, "Install package %s-%s" % (
                        pkg.Name(), pkg.Version())
                elif op == "upgrade":
                    print >> sys.stderr, "Upgrade package %s %s->%s" % (
                        pkg.Name(), old.Version(), pkg.Version())
                else:
                    print >> sys.stderr, "Unknown package operation %s for packge %s-%s" % (
                        op, pkg.Name(), pkg.Version())
        elif type == "Restart":
            from freenasOS.Update import GetServiceDescription
            for svc in diffs[type]:
                desc = GetServiceDescription(svc)
                if desc:
                    print "%s" % desc
                else:
                    print "Unknown service restart %s?!" % svc
        elif type in ("Train", "Sequence"):
            # Train and Sequence are a single tuple, (old, new)
            old, new = diffs[type]
            print >> sys.stderr, "%s %s -> %s" % (type, old, new)
        elif type == "Reboot":
            rr = diffs[type]
            print >> sys.stderr, "Reboot is (conditionally) %srequired" % (
                "" if rr else "not ")
        else:
            print >> sys.stderrr, "*** Unknown key %s (value %s)" % (
                type, str(diffs[type]))