From da6382b40ff265a5b1b4b10fcf888fbdf9ce7b3f Mon Sep 17 00:00:00 2001 From: John Eckersberg Date: Mon, 10 Dec 2012 15:04:25 -0500 Subject: [PATCH] Refactor parameters into common_{configure,cleanup} Removes duplicated parameters from existing profiles. Also removes the short-lived ldap_configure pseudo-profile. --- bin/aeolus-node | 29 ++++++++++++------------- conf/{ldap_configure => common_cleanup} | 4 +++- conf/common_configure | 10 +++++++++ conf/conductor_cleanup | 3 --- conf/default_cleanup | 3 --- conf/default_configure | 4 ---- conf/deltacloud_cleanup | 3 --- conf/deltacloud_configure | 1 - conf/ec2_configure | 4 ---- conf/imagebuilder_configure | 1 - conf/imagefactory_cleanup | 3 --- conf/imagefactory_configure | 1 - conf/iwhd_cleanup | 3 --- conf/iwhd_configure | 4 ---- conf/mock_configure | 4 ---- conf/rhevm_cleanup | 3 --- conf/rhevm_configure | 4 ---- conf/vsphere_configure | 4 ---- conf/wui_configure | 1 - 19 files changed, 27 insertions(+), 62 deletions(-) rename conf/{ldap_configure => common_cleanup} (69%) create mode 100644 conf/common_configure diff --git a/bin/aeolus-node b/bin/aeolus-node index 6e9755e..eae5e24 100755 --- a/bin/aeolus-node +++ b/bin/aeolus-node @@ -17,10 +17,19 @@ require 'yaml' NODE_DIR='/etc/aeolus-configure/nodes' -ldap_configure_file = File.join(NODE_DIR, 'ldap_configure') profile_file = File.join(NODE_DIR, ARGV[0]) - -[ldap_configure_file, profile_file].each do |f| +common_file = case + when ARGV[0].end_with?('_configure') + File.join(NODE_DIR, 'common_configure') + when ARGV[0].end_with?('_cleanup') + File.join(NODE_DIR, 'common_cleanup') + else + STDERR.puts "Unknown profile type for #{ARGV[0]}, " \ + "should be one of {configure,cleanup}" + exit!(1) + end + +[common_file, profile_file].each do |f| unless File.exists?(f) STDERR.puts "No such file or directory - #{f}" exit!(1) @@ -28,17 +37,7 @@ profile_file = File.join(NODE_DIR, ARGV[0]) end begin - ldap = YAML::load_file(ldap_configure_file)['parameters']['enable_ldap'] -rescue NoMethodError - STDERR.puts "#{ldap_configure_file} does not contain a value for " \ - "'enable_ldap' under the 'parameters' section" - exit!(1) -rescue => e - STDERR.puts e.message - exit!(1) -end - -begin + common_params = YAML::load_file(common_file)['parameters'] profile = YAML::load_file(profile_file) rescue => e STDERR.puts e.message @@ -46,7 +45,7 @@ rescue => e end profile['parameters'] ||= {} -profile['parameters']['enable_ldap'] = ldap +profile['parameters'] = common_params.merge(profile['parameters']) puts YAML::dump(profile) diff --git a/conf/ldap_configure b/conf/common_cleanup similarity index 69% rename from conf/ldap_configure rename to conf/common_cleanup index 65feefb..4e97814 100644 --- a/conf/ldap_configure +++ b/conf/common_cleanup @@ -3,4 +3,6 @@ # anyway.) parameters: - enable_ldap: false + enable_https: true + enable_kerberos: false + enable_security: false diff --git a/conf/common_configure b/conf/common_configure new file mode 100644 index 0000000..fbe4173 --- /dev/null +++ b/conf/common_configure @@ -0,0 +1,10 @@ +# This file is included by other top-level profiles. You should not +# use this profile directly (It has no classes so it won't do anything +# anyway.) + +parameters: + enable_https: true + enable_kerberos: false + enable_ldap: false + enable_security: false + package_provider: rpm diff --git a/conf/conductor_cleanup b/conf/conductor_cleanup index dc5bf7f..58ff9c0 100644 --- a/conf/conductor_cleanup +++ b/conf/conductor_cleanup @@ -1,8 +1,5 @@ #conductor-only cleanup specification --- parameters: - enable_https: true - enable_kerberos: false - enable_security: false classes: - aeolus::conductor::disabled diff --git a/conf/default_cleanup b/conf/default_cleanup index 08069e7..bb65320 100644 --- a/conf/default_cleanup +++ b/conf/default_cleanup @@ -7,9 +7,6 @@ #desire and it will take precedence over this. --- parameters: - enable_https: true - enable_kerberos: false - enable_security: false # Uncomment these to clean up RHEV # rhevm_nfs_server: nfs.server.com # rhevm_nfs_export: /export/export_domain diff --git a/conf/default_configure b/conf/default_configure index be4dd1e..fb41c1c 100644 --- a/conf/default_configure +++ b/conf/default_configure @@ -17,10 +17,6 @@ #configured for kerberos authentication. --- parameters: - enable_https: true - enable_kerberos: false - enable_security: false - package_provider: rpm classes: - aeolus::conductor - aeolus::image-factory diff --git a/conf/deltacloud_cleanup b/conf/deltacloud_cleanup index 415cc0a..b11f647 100644 --- a/conf/deltacloud_cleanup +++ b/conf/deltacloud_cleanup @@ -1,8 +1,5 @@ #deltacloud-only cleanup specification --- parameters: - enable_https: true - enable_kerberos: false - enable_security: false classes: - aeolus::deltacloud::disabled diff --git a/conf/deltacloud_configure b/conf/deltacloud_configure index 329b235..2c43c08 100644 --- a/conf/deltacloud_configure +++ b/conf/deltacloud_configure @@ -1,4 +1,3 @@ parameters: - package_provider: rpm classes: - aeolus::profiles::deltacloud diff --git a/conf/ec2_configure b/conf/ec2_configure index c99ada4..ce78d41 100644 --- a/conf/ec2_configure +++ b/conf/ec2_configure @@ -1,10 +1,6 @@ # ec2 setup configuration. --- parameters: - enable_https: true - enable_kerberos: false - enable_security: false - package_provider: rpm classes: - aeolus::conductor - aeolus::image-factory diff --git a/conf/imagebuilder_configure b/conf/imagebuilder_configure index 7fb49e9..81ce472 100644 --- a/conf/imagebuilder_configure +++ b/conf/imagebuilder_configure @@ -1,5 +1,4 @@ parameters: - package_provider: rpm classes: - aeolus::image-factory - aeolus::iwhd diff --git a/conf/imagefactory_cleanup b/conf/imagefactory_cleanup index f9e2f5e..c1385e7 100644 --- a/conf/imagefactory_cleanup +++ b/conf/imagefactory_cleanup @@ -1,8 +1,5 @@ #imagefactory-only cleanup specification --- parameters: - enable_https: true - enable_kerberos: false - enable_security: false classes: - aeolus::image-factory::disabled diff --git a/conf/imagefactory_configure b/conf/imagefactory_configure index ed15806..f6d6966 100644 --- a/conf/imagefactory_configure +++ b/conf/imagefactory_configure @@ -1,4 +1,3 @@ parameters: - package_provider: rpm classes: - aeolus::image-factory diff --git a/conf/iwhd_cleanup b/conf/iwhd_cleanup index db06e81..c2b5f03 100644 --- a/conf/iwhd_cleanup +++ b/conf/iwhd_cleanup @@ -1,8 +1,5 @@ #iwhd-only cleanup specification --- parameters: - enable_https: true - enable_kerberos: false - enable_security: false classes: - aeolus::iwhd::disabled diff --git a/conf/iwhd_configure b/conf/iwhd_configure index bd00881..5f0a8e6 100644 --- a/conf/iwhd_configure +++ b/conf/iwhd_configure @@ -13,9 +13,5 @@ #intermachine service calls is on the roadmap. --- parameters: - enable_https: true - enable_kerberos: false - enable_security: false - package_provider: rpm classes: - aeolus::iwhd diff --git a/conf/mock_configure b/conf/mock_configure index b745c23..ead0e13 100644 --- a/conf/mock_configure +++ b/conf/mock_configure @@ -1,10 +1,6 @@ # mock setup configuration. --- parameters: - enable_https: true - enable_kerberos: false - enable_security: false - package_provider: rpm classes: - aeolus::conductor - aeolus::image-factory diff --git a/conf/rhevm_cleanup b/conf/rhevm_cleanup index e7e4898..28fae01 100644 --- a/conf/rhevm_cleanup +++ b/conf/rhevm_cleanup @@ -1,9 +1,6 @@ #rhevm-only cleanup specification --- parameters: - enable_https: true - enable_kerberos: false - enable_security: false package_provider: rpm classes: aeolus::profiles::rhevm::disabled: diff --git a/conf/rhevm_configure b/conf/rhevm_configure index 5d1c431..bb2ce34 100644 --- a/conf/rhevm_configure +++ b/conf/rhevm_configure @@ -1,9 +1,5 @@ --- parameters: - enable_https: true - enable_kerberos: false - enable_security: false - package_provider: rpm classes: aeolus::conductor: aeolus::image-factory: diff --git a/conf/vsphere_configure b/conf/vsphere_configure index b3bb477..9aa71b8 100644 --- a/conf/vsphere_configure +++ b/conf/vsphere_configure @@ -1,9 +1,5 @@ --- parameters: - enable_https: true - enable_kerberos: false - enable_security: false - package_provider: rpm classes: aeolus::conductor: aeolus::image-factory: diff --git a/conf/wui_configure b/conf/wui_configure index b2f20c5..711acf6 100644 --- a/conf/wui_configure +++ b/conf/wui_configure @@ -1,5 +1,4 @@ parameters: - package_provider: rpm classes: - aeolus::conductor - aeolus::profiles::conductor