Dima Kuznetsov has posted comments on this change. Change subject: Adding Vdsm cron job check for available packages update ......................................................................
Patch Set 3: (7 comments) https://gerrit.ovirt.org/#/c/38401/3/vdsm/updater-tool File vdsm/updater-tool: Line 58: self.ups = None Line 59: Line 60: def refreshUpdates(self): Line 61: self._cleanCache() Line 62: self.ups = self.provider.getUpdates() return self.getCacheUpdates() Line 63: return self.ups Line 64: Line 65: def getCacheUpdates(self): Line 66: self.ups = self.provider.getUpdates() Line 113: def _parse_args(): Line 114: parser = argparse.ArgumentParser( Line 115: description='updater-tool checks for available packages update') Line 116: parser.add_argument('--output-file', '-o', Line 117: metavar='STRING', metavar is the string shown as argument in usage, I think better to have a name like PATH that describes parameter meaning. Line 118: dest='output', Line 119: required=True, Line 120: help='output file for updates info' Line 121: ) Line 121: ) Line 122: parser.add_argument('--packages', '-p', Line 123: dest='packages', Line 124: default=None, Line 125: metavar=['vdsm', 'libvirt', 'mom'], Check out choices= like suggested below Line 126: action='append', Line 127: help=( Line 128: 'List of packages names to check.\n' Line 129: 'Without passing specific packages the command ' Line 129: 'Without passing specific packages the command ' Line 130: 'will check all available updates') Line 131: ) Line 132: parser.add_argument('--provider', Line 133: dest='provider', This is the dest that will be used by default Line 134: default='yum', Line 135: metavar='STRING', Line 136: help=( Line 137: 'Specify package-management utility to use. \n' Line 131: ) Line 132: parser.add_argument('--provider', Line 133: dest='provider', Line 134: default='yum', Line 135: metavar='STRING', You can use choices=('yum', 'dnf') and argparse will validate this for you. Also, then you don't need METAVAR. Line 136: help=( Line 137: 'Specify package-management utility to use. \n' Line 138: 'Current available options - %s' % Line 139: ('yum, dnf (default: yum)')) Line 145: if __name__ == '__main__': Line 146: args = _parse_args() Line 147: pkgList = args.packages Line 148: outputPrint("checking updates for - %s" % Line 149: (pkgList if pkgList is not None else 'all available packages')) (pkgList or 'all available packages') Line 150: if args.provider == 'yum' and yumSupport: Line 151: au = UpdaterTool(YumProvider) Line 152: elif args.provider == 'dnf' and dnfSupport: Line 153: au = UpdaterTool(DnfProvider) Line 147: pkgList = args.packages Line 148: outputPrint("checking updates for - %s" % Line 149: (pkgList if pkgList is not None else 'all available packages')) Line 150: if args.provider == 'yum' and yumSupport: Line 151: au = UpdaterTool(YumProvider) Maybe updater = ... ? Otherwise it looks like we're dealing with precious metals. Line 152: elif args.provider == 'dnf' and dnfSupport: Line 153: au = UpdaterTool(DnfProvider) Line 154: else: Line 155: outputPrint('Failed to initialize provider for %s' % args.provider) -- To view, visit https://gerrit.ovirt.org/38401 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1f6b83e1c18c05142da095b0b537fa6d9aecb59e Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yaniv Bronhaim <ybron...@redhat.com> Gerrit-Reviewer: Dan Kenigsberg <dan...@redhat.com> Gerrit-Reviewer: Dima Kuznetsov <dkuzn...@redhat.com> Gerrit-Reviewer: Moti Asayag <masa...@redhat.com> Gerrit-Reviewer: Oved Ourfali <oourf...@redhat.com> Gerrit-Reviewer: Yeela Kaplan <ykap...@redhat.com> Gerrit-Reviewer: automat...@ovirt.org Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches