Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions gsa_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,19 @@ def sign(self, password):
self.setXMLContents(doc.toxml())

def writeFile(self, filename):
if os.path.exists(filename):
log.error("Output file exists")
sys.exit(1)
doc = xml.dom.minidom.parseString(self.configXMLString)
outputXMLFile = codecs.open(filename, 'w', "utf-8")
log.debug("Writing XML to %s" % filename)
# GSA newer than 6.? expects '<eef>' to be on the second line.
outputXMLFile.write(doc.toxml().replace("<eef>", "\n<eef>", 1))
if filename == "-":
log.debug("Writing XML to stdout")
# GSA newer than 6.? expects '<eef>' to be on the second line.
sys.stdout.write(doc.toxml().replace("<eef>", "\n<eef>", 1))
else:
if os.path.exists(filename):
log.error("Output file exists")
sys.exit(1)
outputXMLFile = codecs.open(filename, 'w', "utf-8")
log.debug("Writing XML to %s" % filename)
# GSA newer than 6.? expects '<eef>' to be on the second line.
outputXMLFile.write(doc.toxml().replace("<eef>", "\n<eef>", 1))

def verifySignature(self, password):
computedSignature = self.computeSignature(password)
Expand Down Expand Up @@ -913,7 +918,7 @@ def runCusSscript(self, sscript_file, out_fd, timeout=180):
help="Input XML file", metavar="FILE")

parser.add_option("-o", "--output", dest="outputFile",
help="Output file name", metavar="FILE")
help="Output file name or '-', meaning stdout", metavar="FILE")

parser.add_option("-g", "--sign-password", dest="signpassword",
help="Sign password for signing/import/export")
Expand Down