summaryrefslogtreecommitdiffstats
path: root/bin/oscp
diff options
context:
space:
mode:
authorTroy Dawson <tdawson@redhat.com>2015-04-16 16:19:02 -0500
committerTroy Dawson <tdawson@redhat.com>2015-04-16 16:19:02 -0500
commit7f7b582a7bc239e69c147b98c8c2512050f12851 (patch)
treef0701e3ce7a42761e9dfb59218057a46e48a901b /bin/oscp
parentdb9cf8ef4f030f30391e021f360fe0c3db1dce74 (diff)
parent0722304b2f9c94a2f70054e0a3c7feceaedb195c (diff)
downloadopenshift-7f7b582a7bc239e69c147b98c8c2512050f12851.tar.gz
openshift-7f7b582a7bc239e69c147b98c8c2512050f12851.tar.bz2
openshift-7f7b582a7bc239e69c147b98c8c2512050f12851.tar.xz
openshift-7f7b582a7bc239e69c147b98c8c2512050f12851.zip
Merge pull request #158 from openshift/master
Merge master into INT for first v3 INT deploy
Diffstat (limited to 'bin/oscp')
-rwxr-xr-xbin/oscp28
1 files changed, 25 insertions, 3 deletions
diff --git a/bin/oscp b/bin/oscp
index 146bbbea5..461ad0a0f 100755
--- a/bin/oscp
+++ b/bin/oscp
@@ -2,21 +2,34 @@
# vim: expandtab:tabstop=4:shiftwidth=4
import argparse
-import awsutil
import traceback
import sys
import os
import re
+import ConfigParser
+
+from openshift_ansible import awsutil
+
+CONFIG_MAIN_SECTION = 'main'
+CONFIG_INVENTORY_OPTION = 'inventory'
class Oscp(object):
def __init__(self):
+ self.inventory = None
self.file_path = os.path.join(os.path.dirname(os.path.realpath(__file__)))
+
+ # Default the config path to /etc
+ self.config_path = os.path.join(os.path.sep, 'etc', \
+ 'openshift_ansible', \
+ 'openshift_ansible.conf')
+
self.parse_cli_args()
+ self.parse_config_file()
# parse host and user
self.process_host()
- self.aws = awsutil.AwsUtil()
+ self.aws = awsutil.AwsUtil(self.inventory)
# get a dict of host inventory
if self.args.list:
@@ -38,9 +51,18 @@ class Oscp(object):
else:
self.scp()
+ def parse_config_file(self):
+ if os.path.isfile(self.config_path):
+ config = ConfigParser.ConfigParser()
+ config.read(self.config_path)
+
+ if config.has_section(CONFIG_MAIN_SECTION) and \
+ config.has_option(CONFIG_MAIN_SECTION, CONFIG_INVENTORY_OPTION):
+ self.inventory = config.get(CONFIG_MAIN_SECTION, CONFIG_INVENTORY_OPTION)
+
def parse_cli_args(self):
parser = argparse.ArgumentParser(description='Openshift Online SSH Tool.')
- parser.add_argument('-e', '--env',
+ parser.add_argument('-e', '--env',
action="store", help="Environment where this server exists.")
parser.add_argument('-d', '--debug', default=False,
action="store_true", help="debug mode")