summaryrefslogtreecommitdiffstats
path: root/roles/openshift_facts
diff options
context:
space:
mode:
authorMichael Gugino <mgugino@redhat.com>2017-11-16 14:56:14 -0500
committerMichael Gugino <mgugino@redhat.com>2017-12-01 12:32:39 -0500
commit5120f8e90c0178ac7f6d911159ceb278dd87b4c9 (patch)
tree1b1f51b242c259e659e1e09c439504b33d33f0c1 /roles/openshift_facts
parente0e10698184c9a7cf4bf65787771686e46d26603 (diff)
downloadopenshift-5120f8e90c0178ac7f6d911159ceb278dd87b4c9.tar.gz
openshift-5120f8e90c0178ac7f6d911159ceb278dd87b4c9.tar.bz2
openshift-5120f8e90c0178ac7f6d911159ceb278dd87b4c9.tar.xz
openshift-5120f8e90c0178ac7f6d911159ceb278dd87b4c9.zip
Implement container runtime role
Diffstat (limited to 'roles/openshift_facts')
-rwxr-xr-xroles/openshift_facts/library/openshift_facts.py87
1 files changed, 1 insertions, 86 deletions
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py
index bbcdbadd8..d72731a02 100755
--- a/roles/openshift_facts/library/openshift_facts.py
+++ b/roles/openshift_facts/library/openshift_facts.py
@@ -51,39 +51,6 @@ EXAMPLES = '''
'''
-def migrate_docker_facts(facts):
- """ Apply migrations for docker facts """
- params = {
- 'common': (
- 'options'
- ),
- 'node': (
- 'log_driver',
- 'log_options'
- )
- }
- if 'docker' not in facts:
- facts['docker'] = {}
- # pylint: disable=consider-iterating-dictionary
- for role in params.keys():
- if role in facts:
- for param in params[role]:
- old_param = 'docker_' + param
- if old_param in facts[role]:
- facts['docker'][param] = facts[role].pop(old_param)
-
- if 'node' in facts and 'portal_net' in facts['node']:
- facts['docker']['hosted_registry_network'] = facts['node'].pop('portal_net')
-
- # log_options was originally meant to be a comma separated string, but
- # we now prefer an actual list, with backward compatibility:
- if 'log_options' in facts['docker'] and \
- isinstance(facts['docker']['log_options'], string_types):
- facts['docker']['log_options'] = facts['docker']['log_options'].split(",")
-
- return facts
-
-
# TODO: We should add a generic migration function that takes source and destination
# paths and does the right thing rather than one function for common, one for node, etc.
def migrate_common_facts(facts):
@@ -156,7 +123,6 @@ def migrate_admission_plugin_facts(facts):
def migrate_local_facts(facts):
""" Apply migrations of local facts """
migrated_facts = copy.deepcopy(facts)
- migrated_facts = migrate_docker_facts(migrated_facts)
migrated_facts = migrate_common_facts(migrated_facts)
migrated_facts = migrate_node_facts(migrated_facts)
migrated_facts = migrate_hosted_facts(migrated_facts)
@@ -1100,6 +1066,7 @@ def get_version_output(binary, version_cmd):
return output
+# We may need this in the future.
def get_docker_version_info():
""" Parses and returns the docker version info """
result = None
@@ -1113,25 +1080,6 @@ def get_docker_version_info():
return result
-def get_hosted_registry_insecure():
- """ Parses OPTIONS from /etc/sysconfig/docker to determine if the
- registry is currently insecure.
- """
- hosted_registry_insecure = None
- if os.path.exists('/etc/sysconfig/docker'):
- try:
- ini_str = text_type('[root]\n' + open('/etc/sysconfig/docker', 'r').read(), 'utf-8')
- ini_fp = io.StringIO(ini_str)
- config = configparser.RawConfigParser()
- config.readfp(ini_fp)
- options = config.get('root', 'OPTIONS')
- if 'insecure-registry' in options:
- hosted_registry_insecure = True
- except Exception: # pylint: disable=broad-except
- pass
- return hosted_registry_insecure
-
-
def get_openshift_version(facts):
""" Get current version of openshift on the host.
@@ -1583,13 +1531,6 @@ def set_container_facts_if_unset(facts):
deployer_image = 'openshift/origin-deployer'
facts['common']['is_atomic'] = os.path.isfile('/run/ostree-booted')
- # If openshift_docker_use_system_container is set and is True ....
- if 'use_system_container' in list(facts['docker'].keys()):
- # use safe_get_bool as the inventory variable may not be a
- # valid boolean on it's own.
- if safe_get_bool(facts['docker']['use_system_container']):
- # ... set the service name to container-engine
- facts['docker']['service_name'] = 'container-engine'
if 'is_containerized' not in facts['common']:
facts['common']['is_containerized'] = facts['common']['is_atomic']
@@ -1684,7 +1625,6 @@ class OpenShiftFacts(object):
'buildoverrides',
'cloudprovider',
'common',
- 'docker',
'etcd',
'hosted',
'master',
@@ -1845,25 +1785,6 @@ class OpenShiftFacts(object):
local_quota_per_fsgroup="",
set_node_ip=False)
- if 'docker' in roles:
- docker = dict(disable_push_dockerhub=False,
- options='--log-driver=journald')
- # NOTE: This is a workaround for a dnf output racecondition that can occur in
- # some situations. See https://bugzilla.redhat.com/show_bug.cgi?id=918184
- if self.system_facts['ansible_pkg_mgr'] == 'dnf':
- rpm_rebuilddb()
-
- version_info = get_docker_version_info()
- if version_info is not None:
- docker['api_version'] = version_info['api_version']
- docker['version'] = version_info['version']
- docker['gte_1_10'] = LooseVersion(version_info['version']) >= LooseVersion('1.10')
- hosted_registry_insecure = get_hosted_registry_insecure()
- if hosted_registry_insecure is not None:
- docker['hosted_registry_insecure'] = hosted_registry_insecure
- docker['service_name'] = 'docker'
- defaults['docker'] = docker
-
if 'cloudprovider' in roles:
defaults['cloudprovider'] = dict(kind=None)
@@ -2221,12 +2142,6 @@ class OpenShiftFacts(object):
additive_facts_to_overwrite,
protected_facts_to_overwrite)
- if 'docker' in new_local_facts:
- # Convert legacy log_options comma sep string to a list if present:
- if 'log_options' in new_local_facts['docker'] and \
- isinstance(new_local_facts['docker']['log_options'], string_types):
- new_local_facts['docker']['log_options'] = new_local_facts['docker']['log_options'].split(',')
-
new_local_facts = self.remove_empty_facts(new_local_facts)
if new_local_facts != local_facts: