Simone Tiraboschi has posted comments on this change. Change subject: Clean the code to pass pep8 checks ......................................................................
Patch Set 1: (5 comments) http://gerrit.ovirt.org/#/c/26176/1/src/__main__.py File src/__main__.py: Line 173: Line 174: if self.options: Line 175: # Need to parse again to override configuration file options Line 176: self.options, self.args = self.parser.parse_args( Line 177: values=self.options) > please add a ',' after the parameter and go to new line with ')'. Done Line 178: self.from_options(self.options, self.parser) Line 179: # Need to parse out options from the option groups. Line 180: self.from_option_groups(self.options, self.parser) Line 181: Line 287: "%s is not a valid command. Valid commands are '%s' or '%s'" Line 288: ".") % Line 289: (self.command, Line 290: Commands.LIST, Line 291: Commands.UPLOAD)) > please use .format here, Done Line 292: Line 293: if self.command == Commands.UPLOAD: Line 294: if len(args) <= 1: Line 295: raise Exception(_("Files must be supplied for %s commands" % Line 657: dest_dir_stat = os.statvfs(dest_dir) Line 658: dest_dir_size = (dest_dir_stat.f_bavail * dest_dir_stat.f_frsize) Line 659: logging.debug( Line 660: "Size of %s:\t%s bytes\t%.1f 1K-blocks\t%.1f MB" % ( Line 661: ovf_file, size_in_bytes, size_in_bytes / 1024, > please use 1024.0, this is float division. Done Line 662: (size_in_bytes / 1024) / 1024) Line 663: ) Line 664: logging.debug( Line 665: "Available space in %s:\t%s bytes\t%.1f 1K-blocks\t%.1f MB" % ( Line 711: Returns: True if successful and false otherwise. Line 712: """ Line 713: retVal = True Line 714: logging.debug("euid(%s) egid(%s)" % (os.geteuid(), os.getegid())) Line 715: umask_save = os.umask(0137) # Set to 660 > ^^ above comment is not true. 0137 set it to 640, better to remove it. Done Line 716: try: Line 717: src = open(src_file_name, 'r') Line 718: os.setegid(gid) Line 719: os.seteuid(uid) Line 1324: try: Line 1325: f = open(file_name, 'w') Line 1326: f.write("<?xml version='1.0' encoding='UTF-8'?>\n") Line 1327: doc = etree.tostring(tree.getroot(), pretty_print=True, Line 1328: encoding="UTF-8") > The form Done Line 1329: f.write(doc) Line 1330: f.close() Line 1331: except Exception, e: Line 1332: logging.error("Unable to update the OVF XML file. Message: %s" % e) -- To view, visit http://gerrit.ovirt.org/26176 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Idb9f7416f0f81f0913d3c0145cd3c42e05377d71 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-image-uploader Gerrit-Branch: master Gerrit-Owner: Simone Tiraboschi <[email protected]> Gerrit-Reviewer: Sandro Bonazzola <[email protected]> Gerrit-Reviewer: Simone Tiraboschi <[email protected]> Gerrit-Reviewer: [email protected] Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
