From 63cb0571c1cc6c0c2f4f5977cc284206daf76d22 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Tue, 3 Dec 2013 17:51:58 +0000 Subject: [PATCH 1/3] Skip temporary files. --- tests/integration/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/integration/__init__.py b/tests/integration/__init__.py index a3aa6101e0..cc758094e6 100644 --- a/tests/integration/__init__.py +++ b/tests/integration/__init__.py @@ -602,6 +602,8 @@ class AdaptedConfigurationTestCaseMixIn(object): return integration_config_dir for fname in os.listdir(integration_config_dir): + if fname.startswith(('.', '_')): + continue self.get_config_file_path(fname) return TMP_CONF_DIR From 2f0fc076885b0a723172e05ef3dc0dec21648de1 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Tue, 3 Dec 2013 18:58:57 +0000 Subject: [PATCH 2/3] Some more missed `vm_config` to `profiles_config` missed occurrences. --- salt/config.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/salt/config.py b/salt/config.py index d930aed58d..1ce41b88b1 100644 --- a/salt/config.py +++ b/salt/config.py @@ -568,6 +568,7 @@ def include_config(include, orig_path, verbose): main config file. ''' # Protect against empty option + if not include: return {} @@ -833,12 +834,13 @@ def cloud_config(path, env_var='SALT_CLOUD_CONFIG', defaults=None, and not providers_config_path: providers_config_path = os.path.join(config_dir, 'cloud.providers') - if 'vm_config' in overrides and vm_config_path is None: + if 'profiles_config' in overrides and profiles_config_path is None: # The configuration setting is being specified in the main cloud # configuration file - vm_config_path = overrides['vm_config'] - elif 'vm_config' not in overrides and not vm_config and not vm_config_path: - providers_config_path = os.path.join(config_dir, 'cloud.providers') + profiles_config_path = overrides['profiles_config'] + elif 'profiles_config' not in overrides and not profiles_config \ + and not profiles_config_path: + profiles_config_path = os.path.join(config_dir, 'cloud.profiles') # Prepare the deploy scripts search path deploy_scripts_search_path = overrides.get( From 13a9effdaffacb176df7633c93daf4c4601052f6 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Tue, 3 Dec 2013 19:08:30 +0000 Subject: [PATCH 3/3] Add unit tests regarding `include.d` directories loading. --- tests/integration/files/conf/cloud.profiles.d/ec2.conf | 9 +++++++++ .../integration/files/conf/cloud.providers.d/ec2.conf | 10 ++++++++++ tests/unit/cloud_config_test.py | 7 +++++++ 3 files changed, 26 insertions(+) create mode 100644 tests/integration/files/conf/cloud.profiles.d/ec2.conf create mode 100644 tests/integration/files/conf/cloud.providers.d/ec2.conf diff --git a/tests/integration/files/conf/cloud.profiles.d/ec2.conf b/tests/integration/files/conf/cloud.profiles.d/ec2.conf new file mode 100644 index 0000000000..03d2fd21f2 --- /dev/null +++ b/tests/integration/files/conf/cloud.profiles.d/ec2.conf @@ -0,0 +1,9 @@ +# vim: filetype=yaml sw=2 ts=2 fenc=utf-8 et + +Ubuntu-13.04-AMD64: + image: ami-c30360aa + provider: ec2-config + size: Micro Instance + ssh_username: ubuntu + securitygroup: + - default diff --git a/tests/integration/files/conf/cloud.providers.d/ec2.conf b/tests/integration/files/conf/cloud.providers.d/ec2.conf new file mode 100644 index 0000000000..52916712d6 --- /dev/null +++ b/tests/integration/files/conf/cloud.providers.d/ec2.conf @@ -0,0 +1,10 @@ +# vim: filetype=yaml sw=2 ts=2 fenc=utf-8 et +--- + +ec2-config: + id: AAAAAABBBBBCCCCCDDDDDDFFFFF + key: AAAAAABBBBBCCCCCDDDDDDFFFFF + provider: ec2 + keyname: salttest + securitygroup: default + private_key: salttest diff --git a/tests/unit/cloud_config_test.py b/tests/unit/cloud_config_test.py index 5194928c08..0b5b291078 100644 --- a/tests/unit/cloud_config_test.py +++ b/tests/unit/cloud_config_test.py @@ -105,6 +105,13 @@ class CloudConfigTestCase(TestCase): if os.path.isdir(temp_conf_dir): shutil.rmtree(temp_conf_dir) + def test_includes_load(self): + '''cloud.{providers,profiles}.d directories are loaded even if not directly passed''' + config_path = os.path.join(integration.FILES, 'conf', 'cloud') + config = cloudconfig.cloud_config(config_path) + self.assertIn('ec2-config', config['providers']) + self.assertIn('Ubuntu-13.04-AMD64', config['profiles']) + if __name__ == '__main__': from salttesting.parser import run_testcase