From 4653a216324e4deef580722fb6068f783f30a4c8 Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Fri, 17 Nov 2017 15:19:57 -0500 Subject: [PATCH 01/24] Multiple puppet-lint fixes --- manifests/application.pp | 2 +- manifests/application/define.pp | 4 ++-- manifests/application/update.pp | 3 ++- manifests/bootstrap.pp | 2 +- manifests/bootstrap/zsmanage.pp | 2 +- manifests/directive.pp | 5 ++--- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifests/application.pp b/manifests/application.pp index d9cac81..11542cc 100644 --- a/manifests/application.pp +++ b/manifests/application.pp @@ -113,7 +113,7 @@ } } default : { - fail ("ensure can only be present, deployed, defined, absent, undeployed, or latest for ${name}") + fail ("ensure can only be present, deployed, defined, absent, undeployed, or latest for ${name}") } } } diff --git a/manifests/application/define.pp b/manifests/application/define.pp index 39fd50c..d46ae2e 100644 --- a/manifests/application/define.pp +++ b/manifests/application/define.pp @@ -25,9 +25,9 @@ $version = '1.0', $health_check = undef, $logo = '', - ) +) - { +{ $required_options = "--name=${user_app_name} --baseUrl=${base_url} --version=${version}" $logo_option = $logo ? { '' => '', diff --git a/manifests/application/update.pp b/manifests/application/update.pp index 4d95c35..4c7503b 100644 --- a/manifests/application/update.pp +++ b/manifests/application/update.pp @@ -1,5 +1,6 @@ # == Define: zendserver::application::update -# Update an application using the Zend Server SDK (zs-client.phar). This is an internal definition and should not be called directly by a user. +# Update an application using the Zend Server SDK (zs-client.phar). +# This is an internal definition and should not be called directly by a user. # === Parameters # [*target] # Zend Server SDK target from which to remove the application. diff --git a/manifests/bootstrap.pp b/manifests/bootstrap.pp index 10d1646..c568eae 100644 --- a/manifests/bootstrap.pp +++ b/manifests/bootstrap.pp @@ -12,7 +12,7 @@ require => File['/usr/local/zend'], } - if $::zend_gui_completed != 'true' { + if $::zend_gui_completed != true { notify {"You may see error messages if vhost, app, etc. settings are applied (defined) before the bootstrap is complete. If it's the case, just run puppet again.": } include zendserver::bootstrap::exec } diff --git a/manifests/bootstrap/zsmanage.pp b/manifests/bootstrap/zsmanage.pp index 9d67f24..a28c570 100644 --- a/manifests/bootstrap/zsmanage.pp +++ b/manifests/bootstrap/zsmanage.pp @@ -2,7 +2,7 @@ # Bootstrap single server if the fact zend_gui.completed is not true # Use the zsmanage tool class zendserver::bootstrap::zsmanage inherits zendserver::bootstrap { - # TODO:if api_key was not specified then save Zend Server API key as a fact. + # TODO:if api_key was not specified then save Zend Server API key as a fact. $options = "-p ${zendserver::admin_password} -a ${zendserver::accept_eula}" #Check if Zend Server is already bootstrapped. diff --git a/manifests/directive.pp b/manifests/directive.pp index c77c1ca..81d2f54 100644 --- a/manifests/directive.pp +++ b/manifests/directive.pp @@ -35,13 +35,12 @@ # Check if application is deployed by using facter if $directive_value_fact != $directive_value { - zendserver::sdk::command { "directive_change_${downcase_name}": target => $target, api_command => 'configurationStoreDirectives', additional_options => "--directives=\"${name}=${directive_value}\"", - } -> - zendserver::sdk::command { "directive_change_reload_${downcase_name}": + } + -> zendserver::sdk::command { "directive_change_reload_${downcase_name}": target => $target, api_command => 'restartPhp', } From 86deec0d0f78a0667703e5ce20c2fdd9221ccc96 Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Sat, 18 Nov 2017 15:06:08 -0500 Subject: [PATCH 02/24] Disabled ruby 1.9 tests --- .travis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index ed217b0..856e70d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,13 +7,13 @@ sudo: false matrix: fast_finish: true include: - - rvm: 1.9.3 - env: PUPPET_GEM_VERSION="~> 3.0" - - rvm: 1.9.3 - env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" +# - rvm: 1.9.3 +# env: PUPPET_GEM_VERSION="~> 3.0" +# - rvm: 1.9.3 +# env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" - rvm: 2.1.10 env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" - rvm: 2.1.10 env: PUPPET_GEM_VERSION="~> 4.0" STRICT_VARIABLES="yes" notifications: - email: false + email: true From 4417a19423684f856174b17a5dd391d7113fbf03 Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Sat, 18 Nov 2017 15:14:09 -0500 Subject: [PATCH 03/24] Trying to fix travic-ci tests --- Gemfile | 6 +++--- Rakefile | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 7cb5731..606a7f1 100644 --- a/Gemfile +++ b/Gemfile @@ -25,7 +25,7 @@ group :unit_tests do gem 'puppet-lint-version_comparison-check', :require => false gem 'puppetlabs_spec_helper', :require => false gem 'rspec-puppet-facts', :require => false - gem 'rubocop', '~> 0.41.2', :require => false if RUBY_VERSION =~ /^1\.9/ + # gem 'rubocop', '~> 0.41.2', :require => false if RUBY_VERSION =~ /^1\.9/ gem 'rubocop', :require => false if RUBY_VERSION =~ /^2\./ end @@ -40,7 +40,7 @@ group :system_tests do # beaker 3.1+ requires ruby 2.2.5. Lock to 2.0 gem 'beaker', '~> 2.0', :require => false # beaker-rspec 6.0.0 requires beaker 3.0. Lock to 5.0 - gem 'beaker-rspec', '~> 5.0', :require => false +# gem 'beaker-rspec', '~> 5.0', :require => false else gem 'beaker-rspec', :require => false end @@ -55,7 +55,7 @@ gem 'json_pure', '<= 2.0.1', :require => false if RUBY_VERSION =~ /^1\./ if (facterversion = ENV['FACTER_GEM_VERSION']) gem 'facter', facterversion, :require => false else - gem 'facter', :require => false +# gem 'facter', :require => false end if (puppetversion = ENV['PUPPET_GEM_VERSION']) diff --git a/Rakefile b/Rakefile index dfc529c..e6491e6 100644 --- a/Rakefile +++ b/Rakefile @@ -18,7 +18,7 @@ exclude_paths = [ Rake::Task[:lint].clear PuppetLint::RakeTask.new :lint do |config| config.ignore_paths = exclude_paths - config.disable_checks = %w(class_inherits_from_params_class 80chars) + config.disable_checks = %w([class_inherits_from_params_class] [80chars]) config.fail_on_warnings = true end # Puppet-Lint 1.1.0 as well ... From 63385f47fe4de7d999f07952e8c56999eb65cefb Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Sat, 18 Nov 2017 15:19:34 -0500 Subject: [PATCH 04/24] Trying to fix tests --- Gemfile | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Gemfile b/Gemfile index 606a7f1..ffaae10 100644 --- a/Gemfile +++ b/Gemfile @@ -25,7 +25,7 @@ group :unit_tests do gem 'puppet-lint-version_comparison-check', :require => false gem 'puppetlabs_spec_helper', :require => false gem 'rspec-puppet-facts', :require => false - # gem 'rubocop', '~> 0.41.2', :require => false if RUBY_VERSION =~ /^1\.9/ +# gem 'rubocop', '~> 0.41.2', :require => false if RUBY_VERSION =~ /^1\.9/ gem 'rubocop', :require => false if RUBY_VERSION =~ /^2\./ end @@ -37,9 +37,7 @@ end group :system_tests do if RUBY_VERSION < '2.2.5' - # beaker 3.1+ requires ruby 2.2.5. Lock to 2.0 gem 'beaker', '~> 2.0', :require => false - # beaker-rspec 6.0.0 requires beaker 3.0. Lock to 5.0 # gem 'beaker-rspec', '~> 5.0', :require => false else gem 'beaker-rspec', :require => false @@ -54,14 +52,10 @@ gem 'json_pure', '<= 2.0.1', :require => false if RUBY_VERSION =~ /^1\./ if (facterversion = ENV['FACTER_GEM_VERSION']) gem 'facter', facterversion, :require => false -else -# gem 'facter', :require => false end if (puppetversion = ENV['PUPPET_GEM_VERSION']) gem 'puppet', puppetversion, :require => false -else - gem 'puppet', '~> 3.8', :require => false end # vim:ft=ruby From 01a0cee6535c2a77adf713d1f60c9553c993bffb Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Sat, 18 Nov 2017 15:23:56 -0500 Subject: [PATCH 05/24] Trying to fix tests --- Gemfile | 2 -- Rakefile | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index ffaae10..11bf1c2 100644 --- a/Gemfile +++ b/Gemfile @@ -25,7 +25,6 @@ group :unit_tests do gem 'puppet-lint-version_comparison-check', :require => false gem 'puppetlabs_spec_helper', :require => false gem 'rspec-puppet-facts', :require => false -# gem 'rubocop', '~> 0.41.2', :require => false if RUBY_VERSION =~ /^1\.9/ gem 'rubocop', :require => false if RUBY_VERSION =~ /^2\./ end @@ -38,7 +37,6 @@ end group :system_tests do if RUBY_VERSION < '2.2.5' gem 'beaker', '~> 2.0', :require => false -# gem 'beaker-rspec', '~> 5.0', :require => false else gem 'beaker-rspec', :require => false end diff --git a/Rakefile b/Rakefile index e6491e6..a039fc4 100644 --- a/Rakefile +++ b/Rakefile @@ -49,14 +49,14 @@ task :success do end desc 'Run all' -task :all => [ +task :all => %i[ :clean, :test, :success ] desc 'Run rubocop, syntax, lint, and spec tests' -task :test => [ +task :test => %i[ :rubocop, :syntax, :lint, From 17fdde146189e0acd29ccff22b4254d4d538e470 Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Sat, 18 Nov 2017 15:27:49 -0500 Subject: [PATCH 06/24] Trying to fix tests --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index a039fc4..4bd7c40 100644 --- a/Rakefile +++ b/Rakefile @@ -57,7 +57,7 @@ task :all => %i[ desc 'Run rubocop, syntax, lint, and spec tests' task :test => %i[ - :rubocop, +# :rubocop, :syntax, :lint, :spec From 63f5917769fc4df4050787da0f19eebadd9d2b6b Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Sat, 18 Nov 2017 15:30:56 -0500 Subject: [PATCH 07/24] Trying to fix tests --- Rakefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Rakefile b/Rakefile index 4bd7c40..3dc62df 100644 --- a/Rakefile +++ b/Rakefile @@ -57,7 +57,6 @@ task :all => %i[ desc 'Run rubocop, syntax, lint, and spec tests' task :test => %i[ -# :rubocop, :syntax, :lint, :spec From 4f2aa69b16dd53719218db80f7eda97257201a95 Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Sat, 18 Nov 2017 15:33:29 -0500 Subject: [PATCH 08/24] Trying to fix tests --- Rakefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Rakefile b/Rakefile index 3dc62df..f1a94f3 100644 --- a/Rakefile +++ b/Rakefile @@ -57,7 +57,6 @@ task :all => %i[ desc 'Run rubocop, syntax, lint, and spec tests' task :test => %i[ - :syntax, :lint, :spec ] From f05cc3c07099f2d5f71b9baf10fc04d3f2a8f533 Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Sat, 18 Nov 2017 15:51:58 -0500 Subject: [PATCH 09/24] Trying to fix tests --- Rakefile | 78 +++++++++++++++++++------------------------------------- 1 file changed, 26 insertions(+), 52 deletions(-) diff --git a/Rakefile b/Rakefile index f1a94f3..4efae88 100644 --- a/Rakefile +++ b/Rakefile @@ -1,62 +1,36 @@ -require 'rubygems' if RUBY_VERSION < '1.9.0' -# require 'rubocop/rake_task' require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-lint/tasks/puppet-lint' -require 'puppet-syntax/tasks/puppet-syntax' -# require 'metadata-json-lint/rake_task' +require 'metadata-json-lint/rake_task' -# RuboCop::RakeTask.new - -exclude_paths = [ - 'modules/**/*', - 'pkg/**/*', - 'spec/**/*', - 'vendor/**/*' -] - -# Puppet-Lint 1.1.0 -Rake::Task[:lint].clear -PuppetLint::RakeTask.new :lint do |config| - config.ignore_paths = exclude_paths - config.disable_checks = %w([class_inherits_from_params_class] [80chars]) - config.fail_on_warnings = true +if RUBY_VERSION >= '1.9' + require 'rubocop/rake_task' + RuboCop::RakeTask.new end -# Puppet-Lint 1.1.0 as well ... -PuppetLint.configuration.send('disable_140chars') -PuppetLint.configuration.relative = true -PuppetSyntax.exclude_paths = exclude_paths -Rake::Task[:default].prerequisites.clear -task :default => :all - -desc 'Run acceptance tests' -RSpec::Core::RakeTask.new(:acceptance) do |t| - t.pattern = 'spec/acceptance' +if not ENV['SPEC_OPTS'] + ENV['SPEC_OPTS'] = '--format documentation' end -desc 'Run RuboCop' -task :rubocop do - sh 'rubocop' -end - -desc 'Clean up modules / pkg' -task :clean do - sh 'rm -rf modules pkg spec/fixtures' +PuppetLint.configuration.send('disable_80chars') +PuppetLint.configuration.relative = true +PuppetLint.configuration.ignore_paths = ['spec/**/*.pp', 'pkg/**/*.pp'] + +desc 'Validate manifests, templates, and ruby files' +task :validate do + Dir['manifests/**/*.pp'].each do |manifest| + sh "puppet parser validate --noop #{manifest}" + end + Dir['spec/**/*.rb', 'lib/**/*.rb'].each do |ruby_file| + sh "ruby -c #{ruby_file}" unless ruby_file =~ %r{spec/fixtures} + end + Dir['templates/**/*.erb'].each do |template| + sh "erb -P -x -T '-' #{template} | ruby -c" + end end -task :success do - puts "\n\e[32mAll tests passing...\e[0m" +desc 'Run metadata_lint, lint, validate, and spec tests.' +task :test do + [:metadata_lint, :lint, :validate, :spec].each do |test| + Rake::Task[test].invoke + end end - -desc 'Run all' -task :all => %i[ - :clean, - :test, - :success -] - -desc 'Run rubocop, syntax, lint, and spec tests' -task :test => %i[ - :lint, - :spec -] From 44dc7c8d9559f06e6fa67f939f696ad8afc3c25d Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Sat, 18 Nov 2017 15:56:24 -0500 Subject: [PATCH 10/24] Trying to fix tests --- Gemfile | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/Gemfile b/Gemfile index 11bf1c2..b5f6fa8 100644 --- a/Gemfile +++ b/Gemfile @@ -2,27 +2,7 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :unit_tests do gem 'json', :require => false - gem 'puppet-lint-absolute_classname-check', :require => false - gem 'puppet-lint-absolute_template_path', :require => false - gem 'puppet-lint-alias-check', :require => false - gem 'puppet-lint-appends-check', :require => false - gem 'puppet-lint-classes_and_types_beginning_with_digits-check', :require => false - gem 'puppet-lint-empty_string-check', :require => false - gem 'puppet-lint-file_ensure-check', :require => false - gem 'puppet-lint-file_source_rights-check', :require => false - gem 'puppet-lint-leading_zero-check', :require => false - gem 'puppet-lint-numericvariable', :require => false - gem 'puppet-lint-resource_outside_class-check', :require => false - gem 'puppet-lint-resource_reference_syntax', :require => false - gem 'puppet-lint-spaceship_operator_without_tag-check', :require => false - gem 'puppet-lint-strict_indent-check', :require => false - gem 'puppet-lint-trailing_comma-check', :require => false - gem 'puppet-lint-trailing_newline-check', :require => false - gem 'puppet-lint-undef_in_function-check', :require => false - gem 'puppet-lint-unquoted_string-check', :require => false - gem 'puppet-lint-usascii_format-check', :require => false - gem 'puppet-lint-variable_contains_upcase', :require => false - gem 'puppet-lint-version_comparison-check', :require => false + gem 'puppet-lint' :require => false gem 'puppetlabs_spec_helper', :require => false gem 'rspec-puppet-facts', :require => false gem 'rubocop', :require => false if RUBY_VERSION =~ /^2\./ From b4977570462f02a968a2fc55e1606880137fd7be Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Sat, 18 Nov 2017 17:05:17 -0500 Subject: [PATCH 11/24] Trying to fix tests --- Gemfile | 53 ++++++++++++++++++----------------------------------- 1 file changed, 18 insertions(+), 35 deletions(-) diff --git a/Gemfile b/Gemfile index b5f6fa8..37d7def 100644 --- a/Gemfile +++ b/Gemfile @@ -1,39 +1,22 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' -group :unit_tests do - gem 'json', :require => false - gem 'puppet-lint' :require => false - gem 'puppetlabs_spec_helper', :require => false - gem 'rspec-puppet-facts', :require => false - gem 'rubocop', :require => false if RUBY_VERSION =~ /^2\./ -end - -group :development do - # gem 'guard-rake', :require => false - gem 'librarian-puppet', :require => false - gem 'simplecov', :require => false -end +puppetversion = ENV.key?('PUPPET_VERSION') ? ENV['PUPPET_VERSION'] : ['>= 3.3'] +gem 'public_suffix', '~> 2.0.5' +gem 'metadata-json-lint' +gem 'puppet', puppetversion +gem 'puppetlabs_spec_helper' +gem 'puppet-lint' +gem 'facter' +gem 'rspec-puppet' +gem 'beaker' +gem 'beaker-rspec' +gem 'puppet-blacksmith' -group :system_tests do - if RUBY_VERSION < '2.2.5' - gem 'beaker', '~> 2.0', :require => false - else - gem 'beaker-rspec', :require => false - end - gem 'serverspec', :require => false - # gem 'vagrant-wrapper', :require => false +# rspec must be v2 for ruby 1.8.7 +if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9' + gem 'rspec', '~> 2.0' + gem 'rake', '~> 10.0' +else + # rubocop requires ruby >= 1.9 + gem 'rubocop' end - -# json_pure 2.0.2 added a requirement on ruby >= 2. We pin to json_pure 2.0.1 -# if using ruby 1.x -gem 'json_pure', '<= 2.0.1', :require => false if RUBY_VERSION =~ /^1\./ - -if (facterversion = ENV['FACTER_GEM_VERSION']) - gem 'facter', facterversion, :require => false -end - -if (puppetversion = ENV['PUPPET_GEM_VERSION']) - gem 'puppet', puppetversion, :require => false -end - -# vim:ft=ruby From 7e8564bd0d87fa8891024a2411d0b064d9a9780b Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Sat, 18 Nov 2017 17:09:42 -0500 Subject: [PATCH 12/24] Removed deprecated field 'types' --- metadata.json | 1 - 1 file changed, 1 deletion(-) diff --git a/metadata.json b/metadata.json index ef01484..8ddf220 100644 --- a/metadata.json +++ b/metadata.json @@ -38,6 +38,5 @@ "project_page": "http://www.zend.com/en/products/server", "source": "https://github.com/zend-patterns/ZendServerPuppet.git", "summary": "Install and manage Zend Server", - "types": [], "version": "0.2.0" } From 7fc0c079290ec2cd0149283615b2206dfbbe42b8 Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Sat, 18 Nov 2017 17:14:22 -0500 Subject: [PATCH 13/24] Fixed license line https://spdx.org/licenses/ --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 8ddf220..af8a108 100644 --- a/metadata.json +++ b/metadata.json @@ -33,7 +33,7 @@ } ], "description": "Install and manage Zend Server", - "license": "Apache 2", + "license": "Apache-2.0", "name": "zend-zendserver", "project_page": "http://www.zend.com/en/products/server", "source": "https://github.com/zend-patterns/ZendServerPuppet.git", From 74673e0a3dae5830d6e6cc1fa364524185c7302b Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Sat, 18 Nov 2017 17:19:27 -0500 Subject: [PATCH 14/24] linting --- manifests/extension/disable.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/extension/disable.pp b/manifests/extension/disable.pp index 2a5281a..de13580 100644 --- a/manifests/extension/disable.pp +++ b/manifests/extension/disable.pp @@ -18,8 +18,8 @@ target => $target, api_command => 'configurationExtensionsOff', additional_options => "--extensions=\"${name}\"", - } -> - zendserver::sdk::command { "extension_disable_reload_${name}": + } + -> zendserver::sdk::command { "extension_disable_reload_${name}": target => $target, api_command => 'restartPhp', } From 02e857698026f718a1d34223bd617990ecdba049 Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Sat, 18 Nov 2017 17:23:18 -0500 Subject: [PATCH 15/24] linting --- manifests/extension/enable.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/extension/enable.pp b/manifests/extension/enable.pp index 98b8404..7f0ef47 100644 --- a/manifests/extension/enable.pp +++ b/manifests/extension/enable.pp @@ -14,8 +14,8 @@ target => $target, api_command => 'configurationExtensionsOn', additional_options => "--extensions=\"${name}\"", - } -> - zendserver::sdk::command { "extension_enable_reload_${name}": + } + -> zendserver::sdk::command { "extension_enable_reload_${name}": target => $target, api_command => 'restartPhp', } From 4161b7613d3fa59d3621f57ed8e378e299ea407b Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Sat, 18 Nov 2017 17:25:09 -0500 Subject: [PATCH 16/24] lintint --- manifests/init.pp | 14 +++++++------- manifests/repo/redhat.pp | 1 - 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 864dc34..23a10f8 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -99,13 +99,13 @@ validate_re($phpversion, ['\A5.3|5.4|5.5|5.6|7.0|7.1\Z',], 'Only versions 5.4 to 7.1 are supported.') validate_re($admin_api_key_name, ['^\w{5,20}$','api_key_name is required and must be 5-20 characters.']) validate_re($admin_api_key_secret, ['^\w{64}$','api_key_secret is required and must be 64 characters.']) - anchor { 'zendserver::begin': } -> - class { '::zendserver::install': } -> - class { '::zendserver::sdk::install': } -> - class { '::zendserver::bootstrap': } ~> - class { '::zendserver::cluster': } ~> - class { '::zendserver::service': } -> - anchor { 'zendserver::end': } + anchor { 'zendserver::begin': } + -> class { '::zendserver::install': } + -> class { '::zendserver::sdk::install': } + -> class { '::zendserver::bootstrap': } + ~> class { '::zendserver::cluster': } + ~> class { '::zendserver::service': } + -> anchor { 'zendserver::end': } # Removing all notifies because it makes unclean puppet runs # and it is useless as the api_key_name and secret is mandatory diff --git a/manifests/repo/redhat.pp b/manifests/repo/redhat.pp index 7b6a349..2029e0e 100644 --- a/manifests/repo/redhat.pp +++ b/manifests/repo/redhat.pp @@ -15,7 +15,6 @@ /^6.*$/ => 'rpm', /^7.*$/ => 'rpm_apache2.4', } - yumrepo { 'Zend': baseurl => "http://repos.zend.com/zend-server/${zendserver::zend_server_version}/${rpmdir}/${::architecture}", From b0dd0d8693831791503f06f1ad9330181be20e30 Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Sat, 18 Nov 2017 17:29:19 -0500 Subject: [PATCH 17/24] linting --- manifests/vhost.pp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/manifests/vhost.pp b/manifests/vhost.pp index 49dc8e7..918f6d6 100644 --- a/manifests/vhost.pp +++ b/manifests/vhost.pp @@ -83,9 +83,9 @@ $target = 'localadmin', $port = 80, $secure = false, - $sslCertificatePath = undef, - $sslCertificateKeyPath = undef, - $sslCertificateChainPath = undef, + $sslcertificatepath = undef, + $sslcertificatekeypath = undef, + $sslcertificatechainpath = undef, $template = undef, $force_create = false, ) { @@ -97,18 +97,18 @@ port => $port, downcase_vhostname => downcase($vhostname), secure => $secure, - sslCertificatePath => $sslCertificatePath, - sslCertificateKeyPath => $sslCertificateKeyPath, - sslCertificateChainPath => $sslCertificateChainPath, + sslcertificatepath => $sslcertificatepath, + sslcertificatekeyPath => $sslcertificatekeypath, + sslcertificateChainPath => $sslcertificatechainpath, template => $template, force_create => $force_create, } } 'absent' : { zendserver::vhost::remove { $name: - target => $target, - port => $port, - downcase_vhostname => downcase($vhostname), + target => $target, + port => $port, + downcase_vhostname => downcase($vhostname), } } default : { From c3f86383bba8f5eee907cf4677e63f6d734aee6a Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Sat, 18 Nov 2017 17:33:11 -0500 Subject: [PATCH 18/24] linting --- manifests/vhost/add.pp | 12 ++++++------ manifests/vhost/remove.pp | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/manifests/vhost/add.pp b/manifests/vhost/add.pp index 0259f4f..e1b94a0 100644 --- a/manifests/vhost/add.pp +++ b/manifests/vhost/add.pp @@ -26,9 +26,9 @@ $downcase_vhostname, $port = $port, $secure = $secure, - $sslCertificatePath = $sslCertificatePath, - $sslCertificateKeyPath = $sslCertificateKeyPath, - $sslCertificateChainPath = $sslCertificateChainPath, + $sslcertificatepath = $sslcertificatepath, + $sslcertificatekeypath = $sslcertificatekeypath, + $sslcertificatechainpath = $sslcertificatechainpath, $template = $template, $force_create = $force_create,) { $required_options = "--name=${downcase_vhostname} --port=${port}" @@ -42,7 +42,7 @@ } $additional_options = "${required_options} ${template_option} ${force_create_option}" - $secure_options = "--sslCertificatePath=${sslCertificatePath} --sslCertificateKeyPath=${sslCertificateKeyPath}" + $secure_options = "--sslcertificatepath=${sslcertificatepath} --sslcertificateKeypath=${sslcertificatekeypath}" # ${name}_${port} is required to make the vhost unique. Many vhosts can have the same name if they run on different ports. $vhost_name_fact = getvar("::zend_vhost_name_${downcase_vhostname}_${port}") @@ -55,8 +55,8 @@ target => $target, api_command => 'vhostAdd', additional_options => $additional_options, - } -> - zendserver::sdk::command { "vhost_reload_${downcase_vhostname}_${port}": + } + -> zendserver::sdk::command { "vhost_reload_${downcase_vhostname}_${port}": target => $target, api_command => 'restartPhp', } diff --git a/manifests/vhost/remove.pp b/manifests/vhost/remove.pp index 3d74285..4786660 100644 --- a/manifests/vhost/remove.pp +++ b/manifests/vhost/remove.pp @@ -12,9 +12,9 @@ $downcase_vhostname, $port = $port, $secure = $secure, - $sslCertificatePath = $sslCertificatePath, - $sslCertificateKeyPath = $sslCertificateKeyPath, - $sslCertificateChainPath = $sslCertificateChainPath, + $sslcertificatepath = $sslcertificatepath, + $sslcertificatekeypath = $sslcertificatekeypath, + $sslcertificatechainpath = $sslcertificatechainpath, $template = $template, $force_create = $force_create,) { @@ -32,8 +32,8 @@ target => $target, api_command => 'vhostRemove', additional_options => $required_options, - } -> - zendserver::sdk::command { "vhost_reload_${downcase_vhostname}_${port}": + } + -> zendserver::sdk::command { "vhost_reload_${downcase_vhostname}_${port}": target => $target, api_command => 'restartPhp', } From 1de1ff9832921cbf20f1a8648a3a5c194e1e1635 Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Sat, 18 Nov 2017 17:37:32 -0500 Subject: [PATCH 19/24] linting --- manifests/vhost.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/vhost.pp b/manifests/vhost.pp index 918f6d6..810806b 100644 --- a/manifests/vhost.pp +++ b/manifests/vhost.pp @@ -106,9 +106,9 @@ } 'absent' : { zendserver::vhost::remove { $name: - target => $target, - port => $port, - downcase_vhostname => downcase($vhostname), + target => $target, + port => $port, + downcase_vhostname => downcase($vhostname), } } default : { From b2e660de7815bb956012ca4f09e93dbc5bd54365 Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Sat, 18 Nov 2017 17:38:29 -0500 Subject: [PATCH 20/24] linting --- manifests/zsmanage.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/zsmanage.pp b/manifests/zsmanage.pp index 02d197b..e479c4b 100644 --- a/manifests/zsmanage.pp +++ b/manifests/zsmanage.pp @@ -24,11 +24,11 @@ $zssecret, $http_timeout = 60, $additional_options = '', - $zsurl = "${zendserver::zsurl}", + $zsurl = ${zendserver::zsurl}, $onlyif = [],) { exec { "zsmanage_${name}": command => "/usr/local/zend/bin/zs-manage ${command} -N ${zskey} -K ${zssecret} -T ${http_timeout} ${additional_options}", require => Package[$zendserver::install::zendserverpkgname], - onlyif => $onlyif, + onlyif => $onlyif, } } From a2a9e3f361df69dec77254f57c3c697968458422 Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Sat, 18 Nov 2017 18:18:24 -0500 Subject: [PATCH 21/24] linting --- manifests/zsmanage.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/zsmanage.pp b/manifests/zsmanage.pp index e479c4b..4f99f81 100644 --- a/manifests/zsmanage.pp +++ b/manifests/zsmanage.pp @@ -24,7 +24,7 @@ $zssecret, $http_timeout = 60, $additional_options = '', - $zsurl = ${zendserver::zsurl}, + $zsurl = $zendserver::zsurl, $onlyif = [],) { exec { "zsmanage_${name}": command => "/usr/local/zend/bin/zs-manage ${command} -N ${zskey} -K ${zssecret} -T ${http_timeout} ${additional_options}", From 959821b6b5d1630de81cb82e08039d3c8a3f7e30 Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Sat, 18 Nov 2017 19:41:40 -0500 Subject: [PATCH 22/24] Fixed the template if that didn't work under puppet 4 --- manifests/vhost.pp | 4 ++-- manifests/vhost/add.pp | 10 ++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/manifests/vhost.pp b/manifests/vhost.pp index 810806b..9a9d83f 100644 --- a/manifests/vhost.pp +++ b/manifests/vhost.pp @@ -98,8 +98,8 @@ downcase_vhostname => downcase($vhostname), secure => $secure, sslcertificatepath => $sslcertificatepath, - sslcertificatekeyPath => $sslcertificatekeypath, - sslcertificateChainPath => $sslcertificatechainpath, + sslcertificatekeypath => $sslcertificatekeypath, + sslcertificatechainpath => $sslcertificatechainpath, template => $template, force_create => $force_create, } diff --git a/manifests/vhost/add.pp b/manifests/vhost/add.pp index e1b94a0..166c7cd 100644 --- a/manifests/vhost/add.pp +++ b/manifests/vhost/add.pp @@ -30,11 +30,10 @@ $sslcertificatekeypath = $sslcertificatekeypath, $sslcertificatechainpath = $sslcertificatechainpath, $template = $template, - $force_create = $force_create,) { + $force_create = $force_create,){ $required_options = "--name=${downcase_vhostname} --port=${port}" - $template_option = $template ? { - '' => '', - default => "--template=${template}" + if $template != undef { + $template_option = "--template=${template}" } $force_create_option = $force_create ? { true => '--forceCreation=true', @@ -42,14 +41,13 @@ } $additional_options = "${required_options} ${template_option} ${force_create_option}" - $secure_options = "--sslcertificatepath=${sslcertificatepath} --sslcertificateKeypath=${sslcertificatekeypath}" + $secure_options = "--sslcertificatepath=${sslcertificatepath} --sslcertificatekeypath=${sslcertificatekeypath}" # ${name}_${port} is required to make the vhost unique. Many vhosts can have the same name if they run on different ports. $vhost_name_fact = getvar("::zend_vhost_name_${downcase_vhostname}_${port}") #Check if vhost exists by using facter if $vhost_name_fact != undef { - } else { zendserver::sdk::command { "vhost_add_${downcase_vhostname}_${port}": target => $target, From 7ffbb0f80d6a9d419d7d03e9b4bcd128c337b391 Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Sat, 18 Nov 2017 19:50:12 -0500 Subject: [PATCH 23/24] linting --- manifests/vhost/add.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/vhost/add.pp b/manifests/vhost/add.pp index 166c7cd..62937ad 100644 --- a/manifests/vhost/add.pp +++ b/manifests/vhost/add.pp @@ -30,7 +30,7 @@ $sslcertificatekeypath = $sslcertificatekeypath, $sslcertificatechainpath = $sslcertificatechainpath, $template = $template, - $force_create = $force_create,){ + $force_create = $force_create,){ $required_options = "--name=${downcase_vhostname} --port=${port}" if $template != undef { $template_option = "--template=${template}" From 4ab312f9e6050b087db4943c21fb6b2117b82717 Mon Sep 17 00:00:00 2001 From: Ugo Bellavance Date: Sat, 18 Nov 2017 20:01:43 -0500 Subject: [PATCH 24/24] Made the 2 cases consistent for logoutput --- manifests/sdk/command.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/sdk/command.pp b/manifests/sdk/command.pp index b78928d..b0ed237 100644 --- a/manifests/sdk/command.pp +++ b/manifests/sdk/command.pp @@ -61,7 +61,7 @@ cwd => $cwd, try_sleep => $try_sleep, command => "${zs_client} ${api_command} --target=${target} ${additional_options} ", - logoutput => true, + logoutput => false, require => File['/usr/local/zend/bin/zs-client.phar'], } }