[node-patches] Change in ovirt-node[master]: edit-node pep8 fix variable quote/equal spacing

jboggs at redhat.com jboggs at redhat.com
Wed May 15 16:24:41 UTC 2013


Joey Boggs has uploaded a new change for review.

Change subject: edit-node pep8 fix variable quote/equal spacing
......................................................................

edit-node pep8 fix variable quote/equal spacing

Signed-off-by: Joey Boggs <jboggs at redhat.com>
Change-Id: I3e6ebf117054751fd8ec6f947791b6199a4ff9ef
---
M tools/edit-node
1 file changed, 43 insertions(+), 43 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/53/14753/1

diff --git a/tools/edit-node b/tools/edit-node
index cc50c53..aaac12e 100755
--- a/tools/edit-node
+++ b/tools/edit-node
@@ -128,8 +128,8 @@
         if self._LoopImageCreator__imagedir is None:
             self.__ensure_builddir()
             self._LoopImageCreator__imagedir = \
-                tempfile.mkdtemp(dir = os.path.abspath(self.tmpdir),
-                                                       prefix = self.name + "-")
+                tempfile.mkdtemp(dir=os.path.abspath(self.tmpdir),
+                                                       prefix=self.name + "-")
         rtn = self._LoopImageCreator__imagedir + "/ext3fs.img"
         return rtn
     _image = property(__get_image)
@@ -139,10 +139,10 @@
         dev_null = os.open("/dev/null", os.O_WRONLY)
         try:
             out = subprocess.Popen(["/sbin/e2label", self._image],
-                                   stdout = subprocess.PIPE,
-                                   stderr = dev_null).communicate()[0]
+                                   stdout=subprocess.PIPE,
+                                   stderr=dev_null).communicate()[0]
 
-            self._LoopImageCreator__fslabel = out.strip()
+            self._LoopImageCreator__fslabel=out.strip()
 
         except IOError, e:
             raise CreatorError("Failed to determine fsimage LABEL: %s" % e )
@@ -154,16 +154,16 @@
             return
 
         try:
-            self._ImageCreator__builddir = tempfile.mkdtemp(dir =  os.path.abspath(self.tmpdir),
-                                               prefix = "edit-liveos-")
+            self._ImageCreator__builddir=tempfile.mkdtemp(dir=os.path.abspath(self.tmpdir),
+                                               prefix="edit-liveos-")
         except OSError, (err, msg):
             raise CreatorError("Failed create build directory in %s: %s" %
                                (self.tmpdir, msg))
 
     def _run_script(self, script):
 
-        (fd, path) = tempfile.mkstemp(prefix = "script-",
-                                          dir = self._instroot + "/tmp")
+        (fd, path) = tempfile.mkstemp(prefix="script-",
+                                          dir=self._instroot + "/tmp")
 
         logging.debug("copying script to install root: %s" % path)
         shutil.copy(os.path.abspath(script), path)
@@ -173,13 +173,13 @@
         script = "/tmp/" + os.path.basename(path)
 
         try:
-            subprocess.call([script], preexec_fn = self._chroot)
+            subprocess.call([script], preexec_fn=self._chroot)
         except OSError, e:
             raise CreatorError("Failed to execute script %s, %s " % (script, e))
         finally:
             os.unlink(path)
 
-    def mount(self, base_on, cachedir = None):
+    def mount(self, base_on, cachedir=None):
         """mount existing file system.
 
         We have to override mount b/c we many not be creating an new install
@@ -308,7 +308,7 @@
         finally:
             imgmnt.cleanup()
 
-    def mount(self, base_on, cachedir = None):
+    def mount(self, base_on, cachedir=None):
         """mount existing file system.
 
         We have to override mount b/c we many not be creating an new install
@@ -547,8 +547,8 @@
 
     def _run_pre_scripts(self):
         for s in kickstart.get_pre_scripts(self.ks):
-            (fd, path) = tempfile.mkstemp(prefix = "ks-script-",
-                                          dir = self._instroot + "/tmp")
+            (fd, path) = tempfile.mkstemp(prefix="ks-script-",
+                                          dir=self._instroot + "/tmp")
 
             os.write(fd, s.script)
             os.close(fd)
@@ -566,7 +566,7 @@
 
             try:
                 subprocess.check_call([s.interp, script],
-                                      preexec_fn = preexec, env = env)
+                                      preexec_fn=preexec, env=env)
             except OSError, e:
                 raise CreatorError("Failed to execute %%post script "
                                    "with '%s' : %s" % (s.interp, e.strerror))
@@ -656,13 +656,13 @@
                 return False
             cmd = "id -u %s" % user
             f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, \
-                                 preexec_fn = self._chroot)
+                                 preexec_fn=self._chroot)
             old_uid, err = f.communicate()
             cmd = "usermod -u %s %s" % (new_uid, user)
-            f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn = self._chroot)
+            f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn=self._chroot)
             output, err = f.communicate()
             cmd = "find / -uid %s -exec chown %s {} \;" % (old_uid, new_uid)
-            f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn = self._chroot)
+            f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn=self._chroot)
             output, err = f.communicate()
 
     def _change_gid(self, options):
@@ -674,25 +674,25 @@
                 return False
             cmd = "getent group %s | cut -d: -f3" % group
             f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, \
-                                 preexec_fn = self._chroot)
+                                 preexec_fn=self._chroot)
             old_gid, err = f.communicate()
             cmd = "groupmod -g %s %s" % (new_gid, group)
-            f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn = self._chroot)
+            f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn=self._chroot)
             output, err = f.communicate()
             cmd = "find / -gid %s -exec chgrp %s {} \;" % (old_gid.strip(), new_gid)
-            f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn = self._chroot)
+            f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn=self._chroot)
             output, err = f.communicate()
 
     def _print_rpm_manifest(self):
         cmd = "rpm -qa|sort"
-        f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn = self._chroot)
+        f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn=self._chroot)
         output, err = f.communicate()
         print "%s" % output
         return True
 
     def _print_file_manifest(self):
         cmd = "find /"
-        f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn = self._chroot)
+        f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn=self._chroot)
         output, err = f.communicate()
         print "\n%s\n" % output
         return True
@@ -724,28 +724,28 @@
         print "Creating Manifests"
         # Create post-image processing manifests
         cmd = "LC_ALL=C rpm -qa --qf '%%{name}-%%{version}-%%{release}.%%{arch} (%%{SIGPGP:pgpsig})\n' | sort -u > /manifest-%s-%s-rpm.txt" % (timestamp, pkg)
-        f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn = self._chroot)
+        f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn=self._chroot)
         output, err = f.communicate()
 
         cmd = "LC_ALL=C rpm -qa --qf '%%{name}-%%{version}-%%{release}.%%{arch} (%%{SIGPGP:pgpsig})\n' | sort -u > /manifest-%s-%s-rpm.txt" % (timestamp, pkg)
-        f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn = self._chroot)
+        f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn=self._chroot)
         output, err = f.communicate()
 
         cmd = "LC_ALL=C rpm -qa --qf '%%{sourcerpm}\n' | sort -u > /manifest-%s-%s-srpm.txt" % (timestamp, pkg)
-        f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn = self._chroot)
+        f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn=self._chroot)
         output, err = f.communicate()
 
         # collect all included licenses rhbz#601927
         cmd = "LC_ALL=C rpm -qa --qf '%%{license}\n' | sort -u > /manifest-%s-%s-license.txt" % (timestamp, pkg)
-        f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn = self._chroot)
+        f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn=self._chroot)
         output, err = f.communicate()
 
         cmd = "du -akx --exclude=/var/cache/yum / > /manifest-%s-%s-file.txt" % (timestamp, pkg)
-        f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn = self._chroot)
+        f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn=self._chroot)
         output, err = f.communicate()
 
         cmd = "du -x --exclude=/var/cache/yum / > /manifest-%s-%s-dir.txt" % (timestamp, pkg)
-        f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn = self._chroot)
+        f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn=self._chroot)
         output, err = f.communicate()
 
         # create plugin info
@@ -755,12 +755,12 @@
             # get version-release
             cmd = "rpm -q %s --qf '%%{version}-%%{release}.%%{arch}\n'" % pkg
             f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, \
-                                 preexec_fn = self._chroot)
+                                 preexec_fn=self._chroot)
             vr, err = f.communicate()
             # get install date
             cmd = "LC_ALL=C rpm -q %s --qf '%%{INSTALLTIME:date}\n'" % pkg
             f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, \
-                                 preexec_fn = self._chroot)
+                                 preexec_fn=self._chroot)
             install_date, err = f.communicate()
             if os.path.isfile(pkg):
                 #get rpm name
@@ -786,7 +786,7 @@
                 f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT)
                 output, err = f.communicate()
             cmd = "diff -u /manifest-%s.txt /manifest-%s-%s-%s.txt |egrep -v \"^@|^ \"> /delta-%s-manifest-%s-%s.txt" % (i, timestamp, pkg, i, timestamp, i, pkg)
-            f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn = self._chroot)
+            f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn=self._chroot)
             output, err = f.communicate()
         for i in ["rpm", "srpm", "license"]:
             if os.path.exists("%s/iso/isolinux/current-manifest-%s.txt" % (self._ImageCreator__builddir, i)):
@@ -798,7 +798,7 @@
                 f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT)
                 output, err = f.communicate()
             cmd = "diff -u /manifest-%s.txt /manifest-%s-%s-%s.txt |egrep -v \"^@|^ \" > /delta-%s-manifest-%s-%s.txt" % (i, timestamp, pkg, i, timestamp, i, pkg)
-            f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn = self._chroot)
+            f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn=self._chroot)
             output, err = f.communicate()
         # cleanup copied manifests
         for i in ["rpm", "srpm", "license", "file", "dir","owns", "deps"]:
@@ -838,8 +838,8 @@
             os.chdir(cwd)
 
     def _mount_iso(self, iso):
-        t = tempfile.mkdtemp(dir =  os.path.abspath(self.tmpdir),
-                             prefix = "edit-liveos-")
+        t = tempfile.mkdtemp(dir=os.path.abspath(self.tmpdir),
+                             prefix="edit-liveos-")
         cmd = "mount -o loop %s %s" % (iso, t)
         f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT)
         output, err = f.communicate()
@@ -1001,13 +1001,13 @@
 
     def _setup_yum_repo(self, options):
         print "Configuring Yum Repo"
-        self.dd_dir = tempfile.mkdtemp(dir =  os.path.abspath(self.tmpdir), prefix = "dd-iso")
+        self.dd_dir = tempfile.mkdtemp(dir=os.path.abspath(self.tmpdir), prefix="dd-iso")
         if not options.repo:
             return True
         else:
             if os.path.isfile(options.repo) and not options.repo.lower().endswith(".iso"):
                 cmd = "touch /etc/yum.repos.d/plugin.repo"
-                f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn = self._chroot)
+                f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn=self._chroot)
                 output, err = f.communicate()
                 if f.returncode > 0:
                     print output
@@ -1089,7 +1089,7 @@
         for entry in _doc_loc:
             valid_write_locations.append(entry)
         cmd = "rpm -ql %s" % rpm
-        f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn = self._chroot)
+        f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn=self._chroot)
         output, err = f.communicate()
         output = output.splitlines()
         i_files = []
@@ -1203,7 +1203,7 @@
             print cmd
             try:
                 print self._chroot
-                subprocess.call([cmd], preexec_fn = self._chroot, shell=True)
+                subprocess.call([cmd], preexec_fn=self._chroot, shell=True)
             except OSError, e:
                 raise CreatorError("Failed to set password, %s " % e)
 
@@ -1233,11 +1233,11 @@
         dracut_conf.write('add_dracutmodules+="dmsquash-live"')
         dracut_conf.close()
         cmd = "rpm -q kernel"
-        f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn = self._chroot)
+        f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn=self._chroot)
         output, err = f.communicate()
         kver = output.strip().replace("kernel-","")
         cmd = "new-kernel-pkg --package kernel --mkinitrd --dracut --depmod --update %s" % kver
-        f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn = self._chroot)
+        f = subprocess.Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, preexec_fn=self._chroot)
         output, err = f.communicate()
         if f.returncode > 0:
             print output
@@ -1257,7 +1257,7 @@
 
 
 def parse_options(args):
-    parser = optparse.OptionParser(option_class=MultipleOption, usage = """
+    parser = optparse.OptionParser(option_class=MultipleOption, usage="""
        %prog [-n=<name>]
                       [-o <output>]
                       [-w <user,encrypted password>
@@ -1442,7 +1442,7 @@
             return False
         # only mount rootfs as required since it's not necesary for all operations
         elif mount:
-            editor.mount(LiveOS, cachedir = None)
+            editor.mount(LiveOS, cachedir=None)
             if options.printversion:
                 ver = editor._print_version()
                 print "\n%s\n" % ver


--
To view, visit http://gerrit.ovirt.org/14753
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3e6ebf117054751fd8ec6f947791b6199a4ff9ef
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Joey Boggs <jboggs at redhat.com>



More information about the node-patches mailing list