From 11d68d1ebe2f3f04d65fa340ec87470c2bd6762d Mon Sep 17 00:00:00 2001 From: James Laska Date: Mon, 25 Jul 2016 15:09:16 -0400 Subject: [PATCH] Complete Sat6 integration Various fixes to get sat-6 integration working. * inventory_import.py - the inventory script is called foreman.py * tasks.py - be sure to call `add_section()` before using it * defaults.py - Add various SATELLITE6_* enablement variables Relates #3119 --- awx/main/management/commands/inventory_import.py | 1 + awx/main/tasks.py | 2 ++ awx/plugins/inventory/cloudforms.py | 0 awx/plugins/inventory/foreman.py | 1 - awx/settings/defaults.py | 10 ++++++++++ 5 files changed, 13 insertions(+), 1 deletion(-) mode change 100644 => 100755 awx/plugins/inventory/cloudforms.py mode change 100644 => 100755 awx/plugins/inventory/foreman.py diff --git a/awx/main/management/commands/inventory_import.py b/awx/main/management/commands/inventory_import.py index 73bb0f99f4..21031f23cc 100644 --- a/awx/main/management/commands/inventory_import.py +++ b/awx/main/management/commands/inventory_import.py @@ -481,6 +481,7 @@ def load_inventory_source(source, all_group=None, group_filter_re=None, # Sanity check: We sanitize these module names for our API but Ansible proper doesn't follow # good naming conventions source = source.replace('azure.py', 'windows_azure.py') + source = source.replace('satellite6.py', 'foreman.py') logger.debug('Analyzing type of source: %s', source) original_all_group = all_group if not os.path.exists(source): diff --git a/awx/main/tasks.py b/awx/main/tasks.py index 7cd4c3c9c4..17268515b5 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -1299,9 +1299,11 @@ class RunInventoryUpdate(BaseTask): cp.set(section, 'password', decrypt_field(credential, 'password')) section = 'ansible' + cp.add_section(section) cp.set(section, 'group_patterns', '["{app}-{tier}-{color}", "{app}-{color}", "{app}", "{tier}"]') section = 'cache' + cp.add_section(section) cp.set(section, 'path', '/tmp') cp.set(section, 'max_age', '0') diff --git a/awx/plugins/inventory/cloudforms.py b/awx/plugins/inventory/cloudforms.py old mode 100644 new mode 100755 diff --git a/awx/plugins/inventory/foreman.py b/awx/plugins/inventory/foreman.py old mode 100644 new mode 100755 index 57367b1e77..7eff557cf1 --- a/awx/plugins/inventory/foreman.py +++ b/awx/plugins/inventory/foreman.py @@ -4,7 +4,6 @@ # # vim: set fileencoding=utf-8 : # -# Copyright (C) 2016 Guido Günther # # This script is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/awx/settings/defaults.py b/awx/settings/defaults.py index 9954433484..7fc78c90aa 100644 --- a/awx/settings/defaults.py +++ b/awx/settings/defaults.py @@ -672,6 +672,16 @@ OPENSTACK_HOST_FILTER = r'^.+$' OPENSTACK_EXCLUDE_EMPTY_GROUPS = True OPENSTACK_INSTANCE_ID_VAR = 'openstack.id' +# --------------------- +# ----- Foreman ----- +# --------------------- +SATELLITE6_ENABLED_VAR = 'foreman.enabled' +SATELLITE6_ENABLED_VALUE = 'true' +SATELLITE6_GROUP_FILTER = r'^.+$' +SATELLITE6_HOST_FILTER = r'^.+$' +SATELLITE6_EXCLUDE_EMPTY_GROUPS = True +SATELLITE6_INSTANCE_ID_VAR = 'foreman.uuid' + # --------------------- # -- Activity Stream -- # ---------------------