Skip to content

Commit

Permalink
BUG: psql_initdb: fix function call
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Wagner <sebix@sebix.at>
  • Loading branch information
sebix committed Oct 13, 2016
1 parent 3f2e494 commit 7ae6042
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions intelmq/bin/intelmq_psql_initdb.py
Expand Up @@ -16,7 +16,7 @@
from intelmq import HARMONIZATION_CONF_FILE


def main():
def generate():
FIELDS = dict()

try:
Expand Down Expand Up @@ -67,7 +67,7 @@ def main():
return initdb


if __name__ == '__main__':
def main():
OUTPUTFILE = "/tmp/initdb.sql"
fp = None
try:
Expand All @@ -78,9 +78,13 @@ def main():
fp = os.fdopen(os_fp, 'wt')
else:
fp = open(OUTPUTFILE, 'wt')
psql = main()
psql = generate()
print("INFO - Writing %s file" % OUTPUTFILE)
fp.write(psql)
finally:
if fp:
fp.close()


if __name__ == '__main__':
main()
2 changes: 1 addition & 1 deletion intelmq/tests/bin/test_psql_initdb.py
Expand Up @@ -20,7 +20,7 @@ def test_output(self):
with open(os.path.join(os.path.dirname(__file__),
'initdb.sql')) as handle:
expected = handle.read()
self.assertEqual(psql_initd.main().strip(), expected.strip())
self.assertEqual(psql_initd.generate().strip(), expected.strip())


if __name__ == '__main__':
Expand Down

0 comments on commit 7ae6042

Please sign in to comment.