summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorDiego Castro <spinolacastro@gmail.com>2015-10-22 16:22:43 -0300
committerDiego Castro <spinolacastro@gmail.com>2015-10-22 16:22:43 -0300
commitf559eb3146c65a6ec58f0fed3eb2d1124c1314c7 (patch)
tree24975a7a87568784b88252bc70d14f7b302670b0 /bin
parent8468d25fae71c80277c10ad975641cb1ba230fd8 (diff)
parente6d426fddd79c08452195cd32286bb600f62d51d (diff)
downloadopenshift-f559eb3146c65a6ec58f0fed3eb2d1124c1314c7.tar.gz
openshift-f559eb3146c65a6ec58f0fed3eb2d1124c1314c7.tar.bz2
openshift-f559eb3146c65a6ec58f0fed3eb2d1124c1314c7.tar.xz
openshift-f559eb3146c65a6ec58f0fed3eb2d1124c1314c7.zip
fix merge conflicts
Diffstat (limited to 'bin')
-rwxr-xr-xbin/cluster60
-rw-r--r--bin/openshift-ansible-bin.spec20
-rwxr-xr-xbin/oscp4
-rwxr-xr-xbin/ossh4
4 files changed, 58 insertions, 30 deletions
diff --git a/bin/cluster b/bin/cluster
index c80fe0cab..59a6755d3 100755
--- a/bin/cluster
+++ b/bin/cluster
@@ -5,6 +5,7 @@ import argparse
import ConfigParser
import os
import sys
+import subprocess
import traceback
@@ -48,11 +49,11 @@ class Cluster(object):
deployment_type = os.environ['OS_DEPLOYMENT_TYPE']
return deployment_type
+
def create(self, args):
"""
Create an OpenShift cluster for given provider
:param args: command line arguments provided by user
- :return: exit status from run command
"""
env = {'cluster_id': args.cluster_id,
'deployment_type': self.get_deployment_type(args)}
@@ -64,65 +65,60 @@ class Cluster(object):
env['num_infra'] = args.infra
env['num_etcd'] = args.etcd
- return self.action(args, inventory, env, playbook)
+ self.action(args, inventory, env, playbook)
def terminate(self, args):
"""
Destroy OpenShift cluster
:param args: command line arguments provided by user
- :return: exit status from run command
"""
env = {'cluster_id': args.cluster_id,
'deployment_type': self.get_deployment_type(args)}
playbook = "playbooks/{}/openshift-cluster/terminate.yml".format(args.provider)
inventory = self.setup_provider(args.provider)
- return self.action(args, inventory, env, playbook)
+ self.action(args, inventory, env, playbook)
def list(self, args):
"""
List VMs in cluster
:param args: command line arguments provided by user
- :return: exit status from run command
"""
env = {'cluster_id': args.cluster_id,
'deployment_type': self.get_deployment_type(args)}
playbook = "playbooks/{}/openshift-cluster/list.yml".format(args.provider)
inventory = self.setup_provider(args.provider)
- return self.action(args, inventory, env, playbook)
+ self.action(args, inventory, env, playbook)
def config(self, args):
"""
Configure or reconfigure OpenShift across clustered VMs
:param args: command line arguments provided by user
- :return: exit status from run command
"""
env = {'cluster_id': args.cluster_id,
'deployment_type': self.get_deployment_type(args)}
playbook = "playbooks/{}/openshift-cluster/config.yml".format(args.provider)
inventory = self.setup_provider(args.provider)
- return self.action(args, inventory, env, playbook)
+ self.action(args, inventory, env, playbook)
def update(self, args):
"""
Update to latest OpenShift across clustered VMs
:param args: command line arguments provided by user
- :return: exit status from run command
"""
env = {'cluster_id': args.cluster_id,
'deployment_type': self.get_deployment_type(args)}
playbook = "playbooks/{}/openshift-cluster/update.yml".format(args.provider)
inventory = self.setup_provider(args.provider)
- return self.action(args, inventory, env, playbook)
+ self.action(args, inventory, env, playbook)
def service(self, args):
"""
Make the same service call across all nodes in the cluster
:param args: command line arguments provided by user
- :return: exit status from run command
"""
env = {'cluster_id': args.cluster_id,
'deployment_type': self.get_deployment_type(args),
@@ -131,7 +127,7 @@ class Cluster(object):
playbook = "playbooks/{}/openshift-cluster/service.yml".format(args.provider)
inventory = self.setup_provider(args.provider)
- return self.action(args, inventory, env, playbook)
+ self.action(args, inventory, env, playbook)
def setup_provider(self, provider):
"""
@@ -141,10 +137,14 @@ class Cluster(object):
"""
config = ConfigParser.ConfigParser()
if 'gce' == provider:
- config.readfp(open('inventory/gce/hosts/gce.ini'))
+ gce_ini_default_path = os.path.join(
+ 'inventory/gce/hosts/gce.ini')
+ gce_ini_path = os.environ.get('GCE_INI_PATH', gce_ini_default_path)
+ if os.path.exists(gce_ini_path):
+ config.readfp(open(gce_ini_path))
- for key in config.options('gce'):
- os.environ[key] = config.get('gce', key)
+ for key in config.options('gce'):
+ os.environ[key] = config.get('gce', key)
inventory = '-i inventory/gce/hosts'
elif 'aws' == provider:
@@ -163,7 +163,7 @@ class Cluster(object):
boto_configs = [conf for conf in boto_conf_files if conf_exists(conf)]
if len(key_missing) > 0 and len(boto_configs) == 0:
- raise ValueError("PROVIDER aws requires {} environment variable(s). See README_AWS.md".format(missing))
+ raise ValueError("PROVIDER aws requires {} environment variable(s). See README_AWS.md".format(key_missing))
elif 'libvirt' == provider:
inventory = '-i inventory/libvirt/hosts'
@@ -182,7 +182,6 @@ class Cluster(object):
:param inventory: derived provider library
:param env: environment variables for kubernetes
:param playbook: ansible playbook to execute
- :return: exit status from ansible-playbook command
"""
verbose = ''
@@ -212,7 +211,18 @@ class Cluster(object):
sys.stderr.write('RUN [{}]\n'.format(command))
sys.stderr.flush()
- return os.system(command)
+ try:
+ subprocess.check_call(command, shell=True)
+ except subprocess.CalledProcessError as exc:
+ raise ActionFailed("ACTION [{}] failed: {}"
+ .format(args.action, exc))
+
+
+class ActionFailed(Exception):
+ """
+ Raised when action failed.
+ """
+ pass
if __name__ == '__main__':
@@ -258,6 +268,9 @@ if __name__ == '__main__':
meta_parser.add_argument('-t', '--deployment-type',
choices=['origin', 'online', 'enterprise'],
help='Deployment type. (default: origin)')
+ meta_parser.add_argument('-T', '--product-type',
+ choices=['openshift', 'atomic-enterprise'],
+ help='Product type. (default: openshift)')
meta_parser.add_argument('-o', '--option', action='append',
help='options')
@@ -324,14 +337,11 @@ if __name__ == '__main__':
sys.stderr.write('\nACTION [update] aborted by user!\n')
exit(1)
- status = 1
try:
- status = args.func(args)
- if status != 0:
- sys.stderr.write("ACTION [{}] failed with exit status {}\n".format(args.action, status))
- except Exception, e:
+ args.func(args)
+ except Exception as exc:
if args.verbose:
traceback.print_exc(file=sys.stderr)
else:
- sys.stderr.write("{}\n".format(e))
- exit(status)
+ print >>sys.stderr, exc
+ exit(1)
diff --git a/bin/openshift-ansible-bin.spec b/bin/openshift-ansible-bin.spec
index fd2386c9a..d90810bc3 100644
--- a/bin/openshift-ansible-bin.spec
+++ b/bin/openshift-ansible-bin.spec
@@ -1,6 +1,6 @@
Summary: OpenShift Ansible Scripts for working with metadata hosts
Name: openshift-ansible-bin
-Version: 0.0.18
+Version: 0.0.19
Release: 1%{?dist}
License: ASL 2.0
URL: https://github.com/openshift/openshift-ansible
@@ -42,6 +42,24 @@ cp -p openshift_ansible.conf.example %{buildroot}/etc/openshift_ansible/openshif
%config(noreplace) /etc/openshift_ansible/
%changelog
+* Thu Aug 20 2015 Kenny Woodson <kwoodson@redhat.com> 0.0.19-1
+- Updated to show private ips when doing a list (kwoodson@redhat.com)
+- Updated to read config first and default to users home dir
+ (kwoodson@redhat.com)
+- Prevent Ansible from serializing tasks (lhuard@amadeus.com)
+- Infra node support (whearn@redhat.com)
+- Playbook updates for clustered etcd (jdetiber@redhat.com)
+- bin/cluster supports boto credentials as well as env variables
+ (jdetiber@redhat.com)
+- Merge pull request #291 from lhuard1A/profile
+ (twiest@users.noreply.github.com)
+- Add a generic mechanism for passing options (lhuard@amadeus.com)
+- Infrastructure - Validate AWS environment before calling playbooks
+ (jhonce@redhat.com)
+- Add a --profile option to spot which task takes more time
+ (lhuard@amadeus.com)
+- changed Openshift to OpenShift (twiest@redhat.com)
+
* Tue Jun 09 2015 Kenny Woodson <kwoodson@redhat.com> 0.0.18-1
- Implement OpenStack provider (lhuard@amadeus.com)
- * Update defaults and examples to track core concepts guide
diff --git a/bin/oscp b/bin/oscp
index 91fc45cd3..89e90a36a 100755
--- a/bin/oscp
+++ b/bin/oscp
@@ -167,7 +167,7 @@ class Oscp(object):
name = server_info['ec2_tag_Name']
ec2_id = server_info['ec2_id']
ip = server_info['ec2_ip_address']
- print '{ec2_tag_Name:<35} {ec2_tag_environment:<8} {ec2_id:<15} {ec2_ip_address}'.format(**server_info)
+ print '{ec2_tag_Name:<35} {ec2_tag_environment:<8} {ec2_id:<15} {ec2_ip_address:<18} {ec2_private_ip_address}'.format(**server_info)
if limit:
print
@@ -180,7 +180,7 @@ class Oscp(object):
name = server_info['ec2_tag_Name']
ec2_id = server_info['ec2_id']
ip = server_info['ec2_ip_address']
- print '{ec2_tag_Name:<35} {ec2_tag_environment:<5} {ec2_id:<15} {ec2_ip_address}'.format(**server_info)
+ print '{ec2_tag_Name:<35} {ec2_tag_environment:<8} {ec2_id:<15} {ec2_ip_address:<18} {ec2_private_ip_address}'.format(**server_info)
def scp(self):
'''scp files to or from a specified host
diff --git a/bin/ossh b/bin/ossh
index 2ed033305..b6738ee76 100755
--- a/bin/ossh
+++ b/bin/ossh
@@ -156,7 +156,7 @@ class Ossh(object):
name = server_info['ec2_tag_Name']
ec2_id = server_info['ec2_id']
ip = server_info['ec2_ip_address']
- print '{ec2_tag_Name:<35} {ec2_tag_environment:<8} {ec2_id:<15} {ec2_ip_address}'.format(**server_info)
+ print '{ec2_tag_Name:<35} {ec2_tag_environment:<8} {ec2_id:<15} {ec2_ip_address:<18} {ec2_private_ip_address}'.format(**server_info)
if limit:
print
@@ -169,7 +169,7 @@ class Ossh(object):
name = server_info['ec2_tag_Name']
ec2_id = server_info['ec2_id']
ip = server_info['ec2_ip_address']
- print '{ec2_tag_Name:<35} {ec2_tag_environment:<5} {ec2_id:<15} {ec2_ip_address}'.format(**server_info)
+ print '{ec2_tag_Name:<35} {ec2_tag_environment:<8} {ec2_id:<15} {ec2_ip_address:<18} {ec2_private_ip_address}'.format(**server_info)
def ssh(self):
'''SSH to a specified host