Skip to content

Commit

Permalink
fix lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
PascalBourdier committed Sep 1, 2017
1 parent 1f04aba commit b3353df
Show file tree
Hide file tree
Showing 16 changed files with 51 additions and 33 deletions.
4 changes: 2 additions & 2 deletions examples/default_install_from_package.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This code fragment will install the tomcat package from EPEL and start the service
#
class { 'tomcat': }
class { 'epel': }
class { '::tomcat': }
class { '::epel': }
-> tomcat::instance { 'default':
install_from_source => false,
package_name => 'tomcat',
Expand Down
6 changes: 3 additions & 3 deletions examples/default_install_from_source.pp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# This code fragment downloads tomcat 8.0 then starts the service
#
class { 'tomcat': }
class { 'java': }
class { '::tomcat': }
class { '::java': }

tomcat::instance { 'test':
source_url => 'http://mirror.nexcess.net/apache/tomcat/tomcat-8/v8.0.8/bin/apache-tomcat-8.0.8.tar.gz'
source_url => 'http://mirror.nexcess.net/apache/tomcat/tomcat-8/v8.0.8/bin/apache-tomcat-8.0.8.tar.gz',
}
-> tomcat::service { 'default': }
4 changes: 2 additions & 2 deletions examples/instance_with_context.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This code fragment downloads tomcat 7.0.53, creates an instance and adds a context to localhost
#
class { 'tomcat': }
class { 'java': }
class { '::tomcat': }
class { '::java': }

tomcat::instance { 'mycat':
catalina_base => '/opt/apache-tomcat/mycat',
Expand Down
4 changes: 2 additions & 2 deletions examples/instance_with_listener.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This code fragment downloads tomcat 7.0.53, creates an instance and adds a listener
#
class { 'tomcat': }
class { 'java': }
class { '::tomcat': }
class { '::java': }

tomcat::instance { 'mycat':
catalina_base => '/opt/apache-tomcat/mycat',
Expand Down
6 changes: 3 additions & 3 deletions examples/instance_with_realm.pp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code fragment downloads Tomcat 8.0.15, configures an instance, and adds a JNDIRealm nested under a LockOutRealm.
class { 'tomcat': }
class { 'java': }
class { '::tomcat': }
class { '::java': }

tomcat::instance { 'tomcat8':
source_url => 'http://mirror.reverse.net/pub/apache/tomcat/tomcat-8/v8.0.15/bin/apache-tomcat-8.0.15.tar.gz',
Expand All @@ -15,6 +15,6 @@
realm_ensure => 'present',
parent_realm => 'org.apache.catalina.realm.LockOutRealm',
additional_attributes => {
'connectionURL' => 'ldap://localhost'
'connectionURL' => 'ldap://localhost',
},
}
4 changes: 2 additions & 2 deletions examples/instance_with_role_and_user.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This code fragment downloads tomcat 7.0.53, creates an instance and adds a role and user
#
class { 'tomcat': }
class { 'java': }
class { '::tomcat': }
class { '::java': }

tomcat::instance { 'mycat':
catalina_base => '/opt/apache-tomcat/mycat',
Expand Down
12 changes: 6 additions & 6 deletions examples/jsvc_install_from_source.pp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# This code fragment downloads tomcat 8.0, compiles jsvc, then starts the service
#
class { 'tomcat': }
class { 'gcc': }
class { 'java': }
class { '::tomcat': }
class { '::gcc': }
class { '::java': }

tomcat::instance { 'test':
source_url => 'http://mirror.nexcess.net/apache/tomcat/tomcat-8/v8.0.8/bin/apache-tomcat-8.0.8.tar.gz'
source_url => 'http://mirror.nexcess.net/apache/tomcat/tomcat-8/v8.0.8/bin/apache-tomcat-8.0.8.tar.gz',
}
-> archive { 'commons-daemon-native.tar.gz':
extract => true,
Expand All @@ -18,15 +18,15 @@
command => 'JAVA_HOME=/etc/alternatives/java_sdk configure',
creates => "${::tomcat::catalina_home}/bin/commons-daemon-1.0.15-native-src/unix/Makefile",
cwd => "${::tomcat::catalina_home}/bin/commons-daemon-1.0.15-native-src/unix",
path => "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:${::tomcat::catalina_home}/bin/commons-daemon-1.0.15-native-src/unix",
path => "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:${::tomcat::catalina_home}/bin/commons-daemon-1.0.15-native-src/unix", # lint:ignore:140chars
require => [ Class['gcc'], Class['java'] ],
provider => shell,
}
-> exec { 'make jsvc':
command => 'make',
creates => "${::tomcat::catalina_home}/bin/commons-daemon-1.0.15-native-src/unix/jsvc",
cwd => "${::tomcat::catalina_home}/bin/commons-daemon-1.0.15-native-src/unix",
path => "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:${::tomcat::catalina_home}/bin/commons-daemon-1.0.15-native-src/unix",
path => "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:${::tomcat::catalina_home}/bin/commons-daemon-1.0.15-native-src/unix", # lint:ignore:140chars
provider => shell,
}
-> file { 'jsvc':
Expand Down
12 changes: 6 additions & 6 deletions examples/multiple_instances.pp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
class { 'tomcat': }
class { 'java': }
class { '::tomcat': }
class { '::java': }

tomcat::instance { 'tomcat8':
catalina_base => '/opt/apache-tomcat/tomcat8',
source_url => 'http://mirror.nexcess.net/apache/tomcat/tomcat-8/v8.0.8/bin/apache-tomcat-8.0.8.tar.gz'
source_url => 'http://mirror.nexcess.net/apache/tomcat/tomcat-8/v8.0.8/bin/apache-tomcat-8.0.8.tar.gz',
}
-> tomcat::service { 'default':
catalina_base => '/opt/apache-tomcat/tomcat8',
Expand All @@ -22,17 +22,17 @@
port => '8180',
protocol => 'HTTP/1.1',
additional_attributes => {
'redirectPort' => '8543'
'redirectPort' => '8543',
},
}
-> tomcat::config::server::connector { 'tomcat6-ajp':
catalina_base => '/opt/apache-tomcat/tomcat6',
port => '8109',
protocol => 'AJP/1.3',
additional_attributes => {
'redirectPort' => '8543'
'redirectPort' => '8543',
},
}
-> tomcat::service { 'tomcat6':
catalina_base => '/opt/apache-tomcat/tomcat6'
catalina_base => '/opt/apache-tomcat/tomcat6',
}
2 changes: 2 additions & 0 deletions manifests/config/server/context.pp
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,15 @@
$_server_config = "${_catalina_base}/conf/server.xml"
}

# lint:ignore:140chars
if $parent_host and ! $_parent_engine {
$path = "Server/Service[#attribute/name='${_parent_service}']/Engine/Host[#attribute/name='${parent_host}']/Context[#attribute/docBase='${_doc_base}']"
} elsif $parent_host and $_parent_engine {
$path = "Server/Service[#attribute/name='${_parent_service}']/Engine[#attribute/name='${_parent_engine}']/Host[#attribute/name='${parent_host}']/Context[#attribute/docBase='${_doc_base}']"
} else {
$path = "Server/Service[#attribute/name='${_parent_service}']/Engine/Host/Context[#attribute/docBase='${_doc_base}']"
}
# lint:endignore

if $context_ensure =~ /^(absent|false)$/ {
$augeaschanges = "rm ${path}"
Expand Down
8 changes: 7 additions & 1 deletion manifests/config/server/host.pp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,13 @@
$_add_aliases = undef
}

$changes = delete_undef_values(flatten([$_host_name_change, $_app_base, $_additional_attributes, $_attributes_to_remove, $_clear_aliases, $_add_aliases]))
$changes = delete_undef_values(flatten([
$_host_name_change,
$_app_base,
$_additional_attributes,
$_attributes_to_remove,
$_clear_aliases,
$_add_aliases]))
}

augeas { "${_catalina_base}-${parent_service}-host-${name}":
Expand Down
2 changes: 2 additions & 0 deletions manifests/config/server/listener.pp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
$_class_name = $name
}

# lint:ignore:140chars
if $parent_engine and ! $parent_host {
$path = "Server/Service[#attribute/name='${_parent_service}']/Engine[#attribute/name='${parent_engine}']/Listener[#attribute/className='${_class_name}']"
} elsif $parent_engine and $parent_host {
Expand All @@ -59,6 +60,7 @@
} else {
$path = "Server/Listener[#attribute/className='${_class_name}']"
}
# lint:endignore

if $server_config {
$_server_config = $server_config
Expand Down
10 changes: 8 additions & 2 deletions manifests/config/server/realm.pp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@
$puppet_name = "set ${path}[${path_expression}]/#attribute/puppetName ${name}"

if ! empty($additional_attributes) {
$_additional_attributes = suffix(prefix(join_keys_to_values($additional_attributes, " '"), "set ${path}[${path_expression}]/#attribute/"), "'")
$_additional_attributes = suffix(prefix(join_keys_to_values($additional_attributes, " '"),
"set ${path}[${path_expression}]/#attribute/"), "'")
} else {
$_additional_attributes = undef
}
Expand All @@ -108,7 +109,12 @@
$_attributes_to_remove = undef
}

$changes = delete_undef_values(flatten([ $__purge_realms, $puppet_name, $_class_name, $_additional_attributes, $_attributes_to_remove ]))
$changes = delete_undef_values(flatten([
$__purge_realms,
$puppet_name,
$_class_name,
$_additional_attributes,
$_attributes_to_remove ]))
}

augeas { "${_catalina_base}-${parent_service}-${parent_engine}-${parent_host}-${parent_realm}-realm-${name}":
Expand Down
2 changes: 2 additions & 0 deletions manifests/config/server/valve.pp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
$_class_name = $name
}

# lint:ignore:140chars
if $parent_host {
if $parent_context {
$base_path = "Server/Service[#attribute/name='${parent_service}']/Engine/Host[#attribute/name='${parent_host}']/Context[#attribute/docBase='${parent_context}']/Valve[#attribute/className='${_class_name}']"
Expand All @@ -53,6 +54,7 @@
} else {
$base_path = "Server/Service[#attribute/name='${parent_service}']/Engine/Valve[#attribute/className='${_class_name}']"
}
# lint:endignore

if $server_config {
$_server_config = $server_config
Expand Down
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
) {

if $install_from_source {
fail('install_from_source is no longer available in the base class. Please use install_from_source on a specific tomcat::install declaration instead.')
fail('install_from_source is no longer available in the base class. Please use install_from_source on a specific tomcat::install declaration instead.') # lint:ignore:140chars
}
case $::osfamily {
'windows','Solaris','Darwin': {
Expand Down
2 changes: 1 addition & 1 deletion manifests/instance.pp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
}

if $_install_from_source != undef {
warning('Passing install_from_source, source_url, source_strip_first_dir, package_ensure, package_name, or package_options to tomcat::instance is deprecated. Please use tomcat::install instead and point tomcat::instance::catalina_home there.')
warning('Passing install_from_source, source_url, source_strip_first_dir, package_ensure, package_name, or package_options to tomcat::instance is deprecated. Please use tomcat::install instead and point tomcat::instance::catalina_home there.') # lint:ignore:140chars
# XXX This file resource is for backwards compatibility. Previously the base
# class created this directory for source installs, even though it may never
# be used. Users may have created source installs under this directory, so
Expand Down
4 changes: 2 additions & 2 deletions manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@
$_hasstatus = false
$_hasrestart = false
$_start = $start_command ? {
undef => "su -s /bin/bash -c 'CATALINA_HOME=${_catalina_home} CATALINA_BASE=${_catalina_base} ${_catalina_home}/bin/catalina.sh start' ${_user}",
undef => "su -s /bin/bash -c 'CATALINA_HOME=${_catalina_home} CATALINA_BASE=${_catalina_base} ${_catalina_home}/bin/catalina.sh start' ${_user}", # lint:ignore:140chars
default => $start_command
}
$_stop = $stop_command ? {
undef => "su -s /bin/bash -c 'CATALINA_HOME=${_catalina_home} CATALINA_BASE=${_catalina_base} ${_catalina_home}/bin/catalina.sh stop' ${_user}",
undef => "su -s /bin/bash -c 'CATALINA_HOME=${_catalina_home} CATALINA_BASE=${_catalina_base} ${_catalina_home}/bin/catalina.sh stop' ${_user}", # lint:ignore:140chars
default => $stop_command
}
$_status = "ps aux | grep 'catalina.base=${_catalina_base} ' | grep -v grep"
Expand Down

0 comments on commit b3353df

Please sign in to comment.