Skip to content

Fixed all tests #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
79 changes: 17 additions & 62 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,67 +1,22 @@
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 '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

group :development do
# gem 'guard-rake', :require => false
gem 'librarian-puppet', :require => false
gem 'simplecov', :require => false
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
end
gem 'serverspec', :require => false
# gem 'vagrant-wrapper', :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'

# 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
# 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
gem 'facter', :require => false
# rubocop requires ruby >= 1.9
gem 'rubocop'
end

if (puppetversion = ENV['PUPPET_GEM_VERSION'])
gem 'puppet', puppetversion, :require => false
else
gem 'puppet', '~> 3.8', :require => false
end

# vim:ft=ruby
80 changes: 26 additions & 54 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,64 +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 => [
:clean,
:test,
:success
]

desc 'Run rubocop, syntax, lint, and spec tests'
task :test => [
:rubocop,
:syntax,
:lint,
:spec
]
2 changes: 1 addition & 1 deletion manifests/application.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
}
}
}
4 changes: 2 additions & 2 deletions manifests/application/define.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ? {
'' => '',
Expand Down
3 changes: 2 additions & 1 deletion manifests/application/update.pp
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion manifests/bootstrap.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion manifests/bootstrap/zsmanage.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 2 additions & 3 deletions manifests/directive.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}
Expand Down
4 changes: 2 additions & 2 deletions manifests/extension/disable.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}
Expand Down
4 changes: 2 additions & 2 deletions manifests/extension/enable.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}
Expand Down
14 changes: 7 additions & 7 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion manifests/repo/redhat.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
Expand Down
2 changes: 1 addition & 1 deletion manifests/sdk/command.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
}
}
Expand Down
18 changes: 9 additions & 9 deletions manifests/vhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
) {
Expand All @@ -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 : {
Expand Down
Loading