summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSastry Isukapalli <sastry@research.att.com>2018-03-07 20:24:38 -0500
committerSastry Isukapalli <sastry@research.att.com>2018-03-07 20:58:31 -0500
commit422df2fa5f10ea14352b1a319ee7764d704d6050 (patch)
treee711ba013a303df1dd0d5cebcb6951149b2e296c
parent27072ed98f1be56857d782e76ae59f3ebfb6473a (diff)
Clean up code smells, added osdfapp.py
Added osdfapp.py in inclusions. TODO: clean up this structure. Notes: 1) Do not use java-like naming (use get_options instead of getOptions). 2) Do not have commented out code in imports (it got flagged as red) Issue-ID: OPTFRA-102 Change-Id: Ie889b581dc8bf6683ff9bf60a6e14f254a26ef12 Signed-off-by: Sastry Isukapalli <sastry@research.att.com>
-rwxr-xr-xosdfapp.py11
-rw-r--r--pom.xml2
2 files changed, 6 insertions, 7 deletions
diff --git a/osdfapp.py b/osdfapp.py
index 3feb22b..4230e01 100755
--- a/osdfapp.py
+++ b/osdfapp.py
@@ -31,7 +31,6 @@ import json
import osdf.adapters.policy.interface
import osdf.config.credentials
import osdf.config.loader
-# import osdf.datasources.aai.aai_local_cached_data
import osdf.operation.error_handling
import osdf.operation.responses
import traceback
@@ -131,17 +130,16 @@ def internal_failure(error):
def getOptions(argv):
program_version_string = '%%prog %s' % ("v1.0")
- #program_usage = '''usage: spam two eggs''' # optional - will be autogenerated by optparse
program_longdesc = ""
program_license = ""
- # setup option parser
parser = OptionParser(version=program_version_string, epilog=program_longdesc, description=program_license)
parser.add_option("-l", "--local", dest="local", help="run locally", action="store_true", default=False)
parser.add_option("-t", "--devtest", dest="devtest", help="run in dev/test environment", action="store_true", default=False)
parser.add_option("-d", "--debughost", dest="debughost", help="IP Address of host running debug server", default='')
parser.add_option("-p", "--debugport", dest="debugport", help="Port number of debug server", type=int, default=5678)
(opts, args) = parser.parse_args(argv)
+
if (opts.debughost != ''):
print('pydevd.settrace(%s, port=%s)' % (opts.debughost, opts.debugport))
pydevd.settrace(opts.debughost, port=opts.debugport)
@@ -154,12 +152,13 @@ if __name__ == "__main__":
ports = sys_conf['osdf_ports']
internal_port, external_port = ports['internal'], ports['external']
ssl_context = tuple(sys_conf['ssl_context'])
+ local_host = "0.0.0.0"
- common_app_opts = dict(host='0.0.0.0', threaded=True, use_reloader=False)
+ common_app_opts = dict(host=local_host, threaded=True, use_reloader=False)
opts = getOptions(sys.argv)
- if (opts.local == False and opts.devtest == False): # normal deployment
+ if (not opts.local and not opts.devtest): # normal deployment
app.run(port=internal_port, ssl_context=ssl_context, debug=False, **common_app_opts)
else:
- port = internal_port if opts.local == True else external_port
+ port = internal_port if opts.local else external_port
app.run(port=port, debug=True, **common_app_opts)
diff --git a/pom.xml b/pom.xml
index d922d42..8c26612 100644
--- a/pom.xml
+++ b/pom.xml
@@ -39,7 +39,7 @@
<sonar.python.coverage.reportPath>coverage.xml</sonar.python.coverage.reportPath>
<sonar.language>py</sonar.language>
<sonar.pluginname>python</sonar.pluginname>
- <sonar.inclusions>**/**.py</sonar.inclusions>
+ <sonar.inclusions>**/**.py,osdfapp.py</sonar.inclusions>
<sonar.exclusions>test/**.py</sonar.exclusions>
</properties>