Commit 0a1fd4b6 authored by Jérome Perrin's avatar Jérome Perrin

apachedex: small cleanups

parent 0420fe31
...@@ -73,8 +73,8 @@ def main(): ...@@ -73,8 +73,8 @@ def main():
parser.add_argument("apachedex_executable", metavar="APACHEDEX_EXECUTABLE") parser.add_argument("apachedex_executable", metavar="APACHEDEX_EXECUTABLE")
parser.add_argument("output_folder", metavar="OUTPUT_FOLDER") parser.add_argument("output_folder", metavar="OUTPUT_FOLDER")
parser.add_argument("base_url", metavar="BASE_URL") parser.add_argument("base_url", metavar="BASE_URL")
parser.add_argument("--apache-log-list", dest="apache_log_list", nargs='*') parser.add_argument("--apache-log-list", nargs='*')
parser.add_argument("--configuration", dest="configuration") parser.add_argument("--configuration")
args = parser.parse_args() args = parser.parse_args()
config = args.configuration config = args.configuration
...@@ -96,23 +96,15 @@ def main(): ...@@ -96,23 +96,15 @@ def main():
except ValueError as e: except ValueError as e:
print(e) print(e)
return 1 return 1
process_handler = subprocess.Popen(argument_list,
stdout=subprocess.PIPE, try:
stderr=subprocess.PIPE, subprocess.check_output(argument_list, stderr=subprocess.STDOUT)
universal_newlines=True, except subprocess.CalledProcessError as e:
) print("Error running apachedex", e.output)
stdout, stderr = process_handler.communicate()
if process_handler.returncode != 0:
if stderr:
print(stderr)
return 1 return 1
# Check that output_file is a readable file. # Check that output_file is a readable file.
with open(output_file, 'r'): with open(output_file, 'r'):
print(base_url + '/ApacheDex-%s.html' % today) print(base_url + '/ApacheDex-%s.html' % today)
return 0 return 0
if __name__ == "__main__":
sys.exit(main())
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment