diff options
-rw-r--r-- | .tito/packages/openshift-ansible | 2 | ||||
-rw-r--r-- | openshift-ansible.spec | 5 | ||||
-rw-r--r-- | roles/docker/tasks/main.yml | 7 | ||||
-rw-r--r-- | utils/.gitignore | 1 | ||||
-rw-r--r-- | utils/Makefile | 14 | ||||
-rw-r--r-- | utils/etc/ansible.cfg | 3 | ||||
-rw-r--r-- | utils/requirements.txt | 1 | ||||
-rw-r--r-- | utils/src/ooinstall/cli_installer.py | 32 | ||||
-rw-r--r-- | utils/src/ooinstall/oo_config.py | 7 | ||||
-rw-r--r-- | utils/src/ooinstall/openshift_ansible.py | 5 | ||||
-rw-r--r-- | utils/test-requirements.txt | 11 |
11 files changed, 48 insertions, 40 deletions
diff --git a/.tito/packages/openshift-ansible b/.tito/packages/openshift-ansible index 707109b2b..12d2214cc 100644 --- a/.tito/packages/openshift-ansible +++ b/.tito/packages/openshift-ansible @@ -1 +1 @@ -3.3.20-1 ./ +3.4.1-1 ./ diff --git a/openshift-ansible.spec b/openshift-ansible.spec index a5ac84e1a..5042743f8 100644 --- a/openshift-ansible.spec +++ b/openshift-ansible.spec @@ -5,7 +5,7 @@ } Name: openshift-ansible -Version: 3.3.20 +Version: 3.4.1 Release: 1%{?dist} Summary: Openshift and Atomic Enterprise Ansible License: ASL 2.0 @@ -221,6 +221,9 @@ Atomic OpenShift Utilities includes %changelog +* Thu Sep 01 2016 Scott Dodson <sdodson@redhat.com> 3.4.1-1 +- Bump to 3.4.0 + * Wed Aug 31 2016 Scott Dodson <sdodson@redhat.com> 3.3.20-1 - Restore network plugin configuration (sdodson@redhat.com) - Remove openshift_master_metrics_public_url (abutcher@redhat.com) diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index 87a4e7af0..a89f5b91a 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -67,7 +67,7 @@ dest: /etc/sysconfig/docker regexp: '^{{ item.reg_conf_var }}=.*$' line: "{{ item.reg_conf_var }}='{{ item.reg_fact_val | oo_prepend_strings_in_list(item.reg_flag ~ ' ') | join(' ') }}'" - when: item.reg_fact_val != '' and docker_check.stat.isreg + when: item.reg_fact_val != '' and docker_check.stat.isreg is defined and docker_check.stat.isreg with_items: - reg_conf_var: ADD_REGISTRY reg_fact_val: "{{ docker_additional_registries | default(None, true)}}" @@ -96,7 +96,8 @@ reg_fact_val: "{{ docker_no_proxy | default('') | join(',') }}" notify: - restart docker - when: "{{ 'http_proxy' in openshift.common or 'https_proxy' in openshift.common and docker_check.stat.isreg }}" + when: + - docker_check.stat.isreg is defined and docker_check.stat.isreg and '"http_proxy" in openshift.common or "https_proxy" in openshift.common' - name: Set various Docker options lineinfile: @@ -108,7 +109,7 @@ {% if docker_log_options is defined %} {{ docker_log_options | oo_split() | oo_prepend_strings_in_list('--log-opt ') | join(' ')}}{% endif %}\ {% if docker_options is defined %} {{ docker_options }}{% endif %}\ {% if docker_disable_push_dockerhub is defined %} --confirm-def-push={{ docker_disable_push_dockerhub | bool }}{% endif %}'" - when: docker_check.stat.isreg + when: docker_check.stat.isreg is defined and docker_check.stat.isreg notify: - restart docker diff --git a/utils/.gitignore b/utils/.gitignore index 7e72a43c3..facfeee54 100644 --- a/utils/.gitignore +++ b/utils/.gitignore @@ -45,3 +45,4 @@ coverage.xml docs/_build/ oo-install oo-installenv +cover diff --git a/utils/Makefile b/utils/Makefile index dd0b5cdd0..79c27626a 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -35,14 +35,16 @@ clean: @rm -fR build dist rpm-build MANIFEST htmlcov .coverage cover ooinstall.egg-info oo-install @rm -fR $(NAME)env +viewcover: + xdg-open cover/index.html + virtualenv: @echo "#############################################" @echo "# Creating a virtualenv" @echo "#############################################" virtualenv $(NAME)env - . $(NAME)env/bin/activate && pip install -r requirements.txt - . $(NAME)env/bin/activate && pip install pep8 nose coverage mock flake8 PyYAML click - + . $(NAME)env/bin/activate && pip install setuptools==17.1.1 + . $(NAME)env/bin/activate && pip install -r test-requirements.txt # If there are any special things to install do it here # . $(NAME)env/bin/activate && INSTALL STUFF @@ -50,14 +52,14 @@ ci-unittests: @echo "#############################################" @echo "# Running Unit Tests in virtualenv" @echo "#############################################" -# . $(NAME)env/bin/activate && nosetests -v --with-cover --cover-html --cover-min-percentage=80 --cover-package=$(TESTPACKAGE) test/ - . $(NAME)env/bin/activate && nosetests -v test/ + . $(NAME)env/bin/activate && nosetests -v --with-coverage --cover-html --cover-min-percentage=70 --cover-package=$(SHORTNAME) test/ + @echo "VIEW CODE COVERAGE REPORT WITH 'xdg-open cover/index.html' or run 'make viewcover'" ci-pylint: @echo "#############################################" @echo "# Running PyLint Tests in virtualenv" @echo "#############################################" - python -m pylint --rcfile ../git/.pylintrc src/ooinstall/cli_installer.py src/ooinstall/oo_config.py src/ooinstall/openshift_ansible.py src/ooinstall/variants.py + . $(NAME)env/bin/activate && python -m pylint --rcfile ../git/.pylintrc src/ooinstall/cli_installer.py src/ooinstall/oo_config.py src/ooinstall/openshift_ansible.py src/ooinstall/variants.py ci-list-deps: @echo "#############################################" diff --git a/utils/etc/ansible.cfg b/utils/etc/ansible.cfg index b7376ddfc..a53ab6cb1 100644 --- a/utils/etc/ansible.cfg +++ b/utils/etc/ansible.cfg @@ -16,6 +16,9 @@ log_path = /tmp/ansible.log forks = 10 host_key_checking = False nocows = 1 + +retry_files_enabled = False + # Need to handle: # inventory - derive from OO_ANSIBLE_DIRECTORY env var # callback_plugins - derive from pkg_resource.resource_filename diff --git a/utils/requirements.txt b/utils/requirements.txt deleted file mode 100644 index 8b1378917..000000000 --- a/utils/requirements.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/utils/src/ooinstall/cli_installer.py b/utils/src/ooinstall/cli_installer.py index 4d678fb98..2ba7efe3e 100644 --- a/utils/src/ooinstall/cli_installer.py +++ b/utils/src/ooinstall/cli_installer.py @@ -5,15 +5,15 @@ import os import re import sys -from distutils.version import LooseVersion +import logging import click +from pkg_resources import parse_version from ooinstall import openshift_ansible from ooinstall.oo_config import OOConfig from ooinstall.oo_config import OOConfigInvalidHostError from ooinstall.oo_config import Host, Role from ooinstall.variants import find_variant, get_variant_version_combos -import logging installer_log = logging.getLogger('installer') installer_log.setLevel(logging.CRITICAL) installer_file_handler = logging.FileHandler('/tmp/installer.txt') @@ -98,27 +98,6 @@ def list_hosts(hosts): click.echo(' {}: {}'.format(idx, hosts[idx])) -def delete_hosts(hosts): - while True: - list_hosts(hosts) - del_idx = click.prompt('Select host to delete, y/Y to confirm, ' - 'or n/N to add more hosts', default='n') - try: - del_idx = int(del_idx) - hosts.remove(hosts[del_idx]) - except IndexError: - click.echo("\"{}\" doesn't match any hosts listed.".format(del_idx)) - except ValueError: - try: - response = del_idx.lower() - if response in ['y', 'n']: - return hosts, response - click.echo("\"{}\" doesn't correspond to any valid input.".format(del_idx)) - except AttributeError: - click.echo("\"{}\" doesn't correspond to any valid input.".format(del_idx)) - return hosts, None - - def collect_hosts(oo_cfg, existing_env=False, masters_set=False, print_summary=True): """ Collect host information from user. This will later be filled in using @@ -653,8 +632,11 @@ https://docs.openshift.com/enterprise/latest/admin_guide/install/prerequisites.h oo_cfg.deployment.variables['master_routingconfig_subdomain'] = get_master_routingconfig_subdomain() click.clear() + current_version = parse_version( + oo_cfg.settings.get('variant_version', '0.0')) + min_version = parse_version('3.2') if not oo_cfg.settings.get('openshift_http_proxy', None) and \ - LooseVersion(oo_cfg.settings.get('variant_version', '0.0')) >= LooseVersion('3.2'): + current_version >= min_version: http_proxy, https_proxy, proxy_excludes = get_proxy_hostnames_and_excludes() oo_cfg.deployment.variables['proxy_http'] = http_proxy oo_cfg.deployment.variables['proxy_https'] = https_proxy @@ -921,7 +903,7 @@ def uninstall(ctx): @click.option('--latest-minor', '-l', is_flag=True, default=False) @click.option('--next-major', '-n', is_flag=True, default=False) @click.pass_context -# pylint: disable=bad-builtin,too-many-statements +# pylint: disable=too-many-statements def upgrade(ctx, latest_minor, next_major): oo_cfg = ctx.obj['oo_cfg'] diff --git a/utils/src/ooinstall/oo_config.py b/utils/src/ooinstall/oo_config.py index 351c9905d..393b36f6f 100644 --- a/utils/src/ooinstall/oo_config.py +++ b/utils/src/ooinstall/oo_config.py @@ -2,10 +2,11 @@ import os import sys +import logging import yaml from pkg_resources import resource_filename -import logging + installer_log = logging.getLogger('installer') CONFIG_PERSIST_SETTINGS = [ @@ -326,6 +327,10 @@ class OOConfig(object): self.settings['ansible_inventory_path'] = \ '{}/hosts'.format(os.path.dirname(self.config_path)) + # pylint: disable=consider-iterating-dictionary + # Disabled because we shouldn't alter the container we're + # iterating over + # # clean up any empty sets for setting in self.settings.keys(): if not self.settings[setting]: diff --git a/utils/src/ooinstall/openshift_ansible.py b/utils/src/ooinstall/openshift_ansible.py index 09dd1ebc4..75d26c10a 100644 --- a/utils/src/ooinstall/openshift_ansible.py +++ b/utils/src/ooinstall/openshift_ansible.py @@ -4,9 +4,10 @@ import socket import subprocess import sys import os +import logging import yaml from ooinstall.variants import find_variant -import logging + installer_log = logging.getLogger('installer') CFG = None @@ -232,7 +233,7 @@ def load_system_facts(inventory_file, os_facts_path, env_vars, verbose=False): os_facts_path]) installer_log.debug("Going to subprocess out to ansible now with these args: %s", ' '.join(args)) status = subprocess.call(args, env=env_vars, stdout=FNULL) - if not status == 0: + if status != 0: installer_log.debug("Exit status from subprocess was not 0") return [], 1 diff --git a/utils/test-requirements.txt b/utils/test-requirements.txt new file mode 100644 index 000000000..f2216a177 --- /dev/null +++ b/utils/test-requirements.txt @@ -0,0 +1,11 @@ +enum +configparser +pylint +pep8 +nose +coverage +mock +flake8 +PyYAML +click +backports.functools_lru_cache |