summaryrefslogtreecommitdiffstats
path: root/bin/awsutil.py
diff options
context:
space:
mode:
authorThomas Wiest <twiest@users.noreply.github.com>2015-03-30 14:47:06 -0400
committerThomas Wiest <twiest@users.noreply.github.com>2015-03-30 14:47:06 -0400
commitd083ffef71cbb7394e3eab70f1516dd419ce6b92 (patch)
tree4e1dd8346126e37bd79e69e37fcf1f5683a5d002 /bin/awsutil.py
parent78a45fc50509eca27164452325529cc46a99cc8c (diff)
parentb1b462f4db3ce1a26cfc251895d5f8fe2e15c484 (diff)
downloadopenshift-d083ffef71cbb7394e3eab70f1516dd419ce6b92.tar.gz
openshift-d083ffef71cbb7394e3eab70f1516dd419ce6b92.tar.bz2
openshift-d083ffef71cbb7394e3eab70f1516dd419ce6b92.tar.xz
openshift-d083ffef71cbb7394e3eab70f1516dd419ce6b92.zip
Merge pull request #126 from twiest/pr
added config file support to opssh, ossh, and oscp
Diffstat (limited to 'bin/awsutil.py')
-rw-r--r--bin/awsutil.py29
1 files changed, 16 insertions, 13 deletions
diff --git a/bin/awsutil.py b/bin/awsutil.py
index 37259b946..78421e5f5 100644
--- a/bin/awsutil.py
+++ b/bin/awsutil.py
@@ -6,27 +6,30 @@ import json
import re
class AwsUtil(object):
- def __init__(self):
- self.host_type_aliases = {
- 'legacy-openshift-broker': ['broker', 'ex-srv'],
- 'openshift-node': ['node', 'ex-node'],
- 'openshift-messagebus': ['msg'],
- 'openshift-customer-database': ['mongo'],
- 'openshift-website-proxy': ['proxy'],
- 'openshift-community-website': ['drupal'],
- 'package-mirror': ['mirror'],
- }
+ def __init__(self, inventory_path=None, host_type_aliases={}):
+ self.host_type_aliases = host_type_aliases
+ self.file_path = os.path.join(os.path.dirname(os.path.realpath(__file__)))
+
+ if inventory_path is None:
+ inventory_path = os.path.realpath(os.path.join(self.file_path, \
+ '..','inventory','multi_ec2.py'))
+
+ if not os.path.isfile(inventory_path):
+ raise Exception("Inventory file not found [%s]" % inventory_path)
+ self.inventory_path = inventory_path
+ self.setup_host_type_alias_lookup()
+
+ def setup_host_type_alias_lookup(self):
self.alias_lookup = {}
for key, values in self.host_type_aliases.iteritems():
for value in values:
self.alias_lookup[value] = key
- self.file_path = os.path.join(os.path.dirname(os.path.realpath(__file__)))
- self.multi_ec2_path = os.path.realpath(os.path.join(self.file_path, '..','inventory','multi_ec2.py'))
+
def get_inventory(self,args=[]):
- cmd = [self.multi_ec2_path]
+ cmd = [self.inventory_path]
if args:
cmd.extend(args)