From a0841c293e2d9610264c94b2ac10c32d2d85cfe2 Mon Sep 17 00:00:00 2001 From: Sebastien Badia Date: Mon, 27 Apr 2015 22:43:34 +0200 Subject: [PATCH] Manage default configs Add default config for Gemfile, puppet-lint disabled checks, nodepool files for centos7 and trusty, and a sample modulesync.yaml for configuring msync. Co-Authored-By: Cody Herries Change-Id: Ib00a5b3b9c62f063b0b88b2d883e0ebad6506840 --- config_defaults.yml | 26 +++++++++++++++++++ moduleroot/Gemfile | 3 ++- moduleroot/Rakefile | 2 +- .../acceptance/nodesets/nodepool-centos7.yml | 10 +++++++ .../{nodepool.yml => nodepool-trusty.yml} | 1 + moduleroot/spec/spec_helper.rb | 1 + modulesync.yml.sample | 7 +++++ 7 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 config_defaults.yml create mode 100644 moduleroot/spec/acceptance/nodesets/nodepool-centos7.yml rename moduleroot/spec/acceptance/nodesets/{nodepool.yml => nodepool-trusty.yml} (89%) create mode 100644 modulesync.yml.sample diff --git a/config_defaults.yml b/config_defaults.yml new file mode 100644 index 0000000..41ee7f0 --- /dev/null +++ b/config_defaults.yml @@ -0,0 +1,26 @@ +--- +Gemfile: + required: + ':development, :test': + - gem: puppetlabs_spec_helper + - gem: rspec-puppet + version: '~> 2.1.0' + - gem: metadata-json-lint + - gem: puppet-lint-param-docs + - gem: puppet-lint-absolute_classname-check + - gem: puppet-lint-absolute_template_path + - gem: puppet-lint-trailing_newline-check + - gem: puppet-lint-unquoted_string-check + - gem: puppet-lint-leading_zero-check + - gem: puppet-lint-variable_contains_upcase + - gem: puppet-lint-numericvariable + - gem: json + - gem: webmock + ':system_tests': + - gem: beaker-rspec +Rakefile: + default_disabled_lint_checks: + - '80chars' + - 'class_inherits_from_params_class' + - 'class_parameter_defaults' + - 'only_variable_string' diff --git a/moduleroot/Gemfile b/moduleroot/Gemfile index 4ef11a4..4e7328c 100644 --- a/moduleroot/Gemfile +++ b/moduleroot/Gemfile @@ -11,6 +11,7 @@ group <%= group %> do <% { -%> <% 'gem' => gem['gem'], -%> <% 'version' => gem['version'], -%> +<% 'require' => gem['require'], -%> <% 'git' => gem['git'], -%> <% 'branch' => gem['branch'], -%> <% 'length' => gem['gem'].length + (("', '".length if gem['version']) || 0) + gem['version'].to_s.length -%> @@ -19,7 +20,7 @@ group <%= group %> do <% gem['length'] -%> <% end.max -%> <% gems.each do |gem| -%> - gem '<%= gem['gem'] %>'<%= ", '#{gem['version']}'" if gem['version'] %>, <%= ' ' * (maxlen - gem['length']) %> :require => false<%= ", :git => '#{gem['git']}'" if gem['git'] %><%= ", :branch => '#{gem['branch']}'" if gem['branch'] %> + gem '<%= gem['gem'] %>'<%= ", '#{gem['version']}'" if gem['version'] %>, <%= ' ' * (maxlen - gem['length']) %><%= ":require => '#{gem['require'] || false}'" %><%= ", :git => '#{gem['git']}'" if gem['git'] %><%= ", :branch => '#{gem['branch']}'" if gem['branch'] %> <% end -%> end diff --git a/moduleroot/Rakefile b/moduleroot/Rakefile index b150e14..c257964 100644 --- a/moduleroot/Rakefile +++ b/moduleroot/Rakefile @@ -12,7 +12,7 @@ PuppetLint::RakeTask.new :lint do |config| config.ignore_paths = ["spec/**/*.pp", "vendor/**/*.pp"] config.fail_on_warnings = true config.log_format = '%{path}:%{linenumber}:%{KIND}: %{message}' - config.disable_checks = <% @configs['default_disabled_lint_checks'] + ( @configs['extra_disabled_lint_checks'] || [] ) -%> + config.disable_checks = <%= @configs['default_disabled_lint_checks'] + ( @configs['extra_disabled_lint_checks'] || [] ) %> end desc "Run acceptance tests" diff --git a/moduleroot/spec/acceptance/nodesets/nodepool-centos7.yml b/moduleroot/spec/acceptance/nodesets/nodepool-centos7.yml new file mode 100644 index 0000000..575ae67 --- /dev/null +++ b/moduleroot/spec/acceptance/nodesets/nodepool-centos7.yml @@ -0,0 +1,10 @@ +HOSTS: + centos-70-x64: + roles: + - master + platform: el-7-x86_64 + hypervisor : none + ip: 127.0.0.1 +CONFIG: + type: foss + set_env: false diff --git a/moduleroot/spec/acceptance/nodesets/nodepool.yml b/moduleroot/spec/acceptance/nodesets/nodepool-trusty.yml similarity index 89% rename from moduleroot/spec/acceptance/nodesets/nodepool.yml rename to moduleroot/spec/acceptance/nodesets/nodepool-trusty.yml index a2c1ecc..a95d9f3 100644 --- a/moduleroot/spec/acceptance/nodesets/nodepool.yml +++ b/moduleroot/spec/acceptance/nodesets/nodepool-trusty.yml @@ -7,3 +7,4 @@ HOSTS: ip: 127.0.0.1 CONFIG: type: foss + set_env: false diff --git a/moduleroot/spec/spec_helper.rb b/moduleroot/spec/spec_helper.rb index 172614e..3df4ced 100644 --- a/moduleroot/spec/spec_helper.rb +++ b/moduleroot/spec/spec_helper.rb @@ -1,5 +1,6 @@ require 'puppetlabs_spec_helper/module_spec_helper' require 'shared_examples' +require 'webmock/rspec' RSpec.configure do |c| c.alias_it_should_behave_like_to :it_configures, 'configures' diff --git a/modulesync.yml.sample b/modulesync.yml.sample new file mode 100644 index 0000000..2180b9e --- /dev/null +++ b/modulesync.yml.sample @@ -0,0 +1,7 @@ +--- +namespace: stackforge +git_base: ssh://jdoe@review.openstack.org:29418/ +branch: msync_foo +remote_branch: refs/publish/master/msync_foo +# see https://github.com/puppet-community/modulesync/blob/master/contrib/openstack-commit-msg-hook.sh +pre_commit_script: openstack-commit-msg-hook.sh