Signed-off-by: Agata Murawska <[email protected]>
---
 lib/ovf.py |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/lib/ovf.py b/lib/ovf.py
index d413ede..00b9347 100644
--- a/lib/ovf.py
+++ b/lib/ovf.py
@@ -487,11 +487,11 @@ class OVFWriter(object):
   @ivar tree: XML tree that we are constructing
 
   """
-  def __init__(self, ganeti_opts):
+  def __init__(self, has_gnt_section):
     """Initialize the writer - set the top element.
 
-    @type ganeti_opts: bool
-    @param ganeti_opts: if the Ganeti schema should be added - i.e. this means
+    @type has_gnt_section: bool
+    @param has_gnt_section: if the Ganeti schema should be added - i.e. this 
means
       that Ganeti section will be present
 
     """
@@ -503,7 +503,7 @@ class OVFWriter(object):
       "xmlns": OVF_SCHEMA,
       "xml:lang": "en-US",
     }
-    if ganeti_opts:
+    if has_gnt_section:
       env_attribs["xmlns:gnt"] = GANETI_SCHEMA
     self.tree = ET.Element("Envelope", attrib=env_attribs)
 
@@ -1178,10 +1178,10 @@ class OVFExporter(Converter):
     @type input_path: string
     @param input_path: absolute path to the config.ini input file
 
-    @raises errors.OpPrereqError: error when reading the config file
+    @raise errors.OpPrereqError: error when reading the config file
 
     """
-    (input_dir, _) = os.path.split(input_path)
+    input_dir = os.path.dirname(input_path)
     self.input_path = input_path
     self.input_dir = input_dir
     if self.options.output_dir:
@@ -1193,7 +1193,7 @@ class OVFExporter(Converter):
     try:
       self.config_parser.read(input_path)
     except ConfigParser.MissingSectionHeaderError, err:
-      raise errors.OpPrereqError("Error when trying to read %s\n\t%s" %
+      raise errors.OpPrereqError("Error when trying to read %s: %s" %
                                  (input_path, err))
     if self.options.ova_package:
       self.temp_dir = tempfile.mkdtemp()
@@ -1226,7 +1226,7 @@ class OVFExporter(Converter):
     try:
       utils.Makedirs(self.output_dir)
     except OSError, err:
-      raise errors.OpPrereqError("Failed to create directory %s:\n\t%s" %
+      raise errors.OpPrereqError("Failed to create directory %s: %s" %
                                  (self.output_dir, err))
 
     self.results_name = self._ParseName()
@@ -1247,13 +1247,13 @@ class OVFExporter(Converter):
     logging.warning("Calculating SHA1 checksums, this may take a while")
     sha1_sums = utils.FingerprintFiles(files_list)
     for file_path, value in sha1_sums.iteritems():
-      _, file_name = os.path.split(file_path)
-      lines.append("SHA1(%s)= %s\n" % (file_name, value))
-    data = "".join(lines)
+      file_name = os.path.basename(file_path)
+      lines.append("SHA1(%s)= %s" % (file_name, value))
+    data = "\n".join(lines)
     try:
       utils.WriteFile(path, data=data)
     except errors.ProgrammerError, err:
-      raise errors.OpPrereqError("Saving the manifest file failed:\n\t%s" % 
err)
+      raise errors.OpPrereqError("Saving the manifest file failed: %s" % err)
 
   @staticmethod
   def _PrepareTarFile(tar_path, files_list):
@@ -1302,7 +1302,7 @@ class OVFExporter(Converter):
       try:
         utils.Makedirs(self.packed_dir)
       except OSError, err:
-        raise errors.OpPrereqError("Failed to create directory %s:\n\t%s" %
+        raise errors.OpPrereqError("Failed to create directory %s: %s" %
                                    (self.packed_dir, err))
       self._PrepareTarFile(packed_path, files_list)
     logging.info("Creation of the OVF package was successfull")
-- 
1.7.3.1

Reply via email to