Skip to content

Commit 101de4d

Browse files
committed
make linter happy
1 parent bcffc60 commit 101de4d

File tree

8 files changed

+61
-53
lines changed

8 files changed

+61
-53
lines changed

examples/init.pp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
node default {
2-
32
$user = 'root'
43
$password = 'root'
54

6-
class { '::mysql::server':
5+
class { 'mysql::server':
76
root_password => "%${password}%",
87
remove_default_accounts => true,
9-
} ->
10-
class { '::orchestrator':
8+
}
9+
-> class { 'orchestrator':
1110
config_override => {
1211
'MySQLOrchestratorHost' => '127.0.0.1',
1312
},
1413
}
15-
1614
}

manifests/config.pp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#
2-
32
class orchestrator::config inherits orchestrator {
4-
53
# Create a merged together set of options. Rightmost hashes win over left. Requires stdlib
64
$options = merge($orchestrator::config_defaults, $orchestrator::config_override)
75

@@ -12,5 +10,4 @@
1210
mode => '0644',
1311
content => template($orchestrator::config_template),
1412
}
15-
1613
}

manifests/init.pp

Lines changed: 47 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,43 @@
1+
# @summary MySQL orchestrator: For managing replication and failover.
12
#
2-
# MySQL orchestrator: For managing replication and failover.
3-
#
3+
# @param config
4+
# full path to configuration file
5+
# @param config_defaults
6+
# default configuration for orchestrator
7+
# @param config_override
8+
# configuration overlay
9+
# @param config_template
10+
# path to configuration file template
11+
# @param package_ensure
12+
# ensure package resource
13+
# @param package_manage
14+
# if true module will manage package
15+
# @param package_name
16+
# list of packages install. Default ['orchestrator']
17+
# @param repo_manage
18+
# if true module will manage repo with orchestrator package
19+
# @param service_enable
20+
# if true service orchestrator will be enaled at boot
21+
# @param service_ensure
22+
# ensure service resource
23+
# @param service_manage
24+
# if true module willl manage service
25+
# @param service_name
26+
# service name to manage. Default 'orchestrator'
427
class orchestrator (
5-
$config = $orchestrator::params::config,
6-
$config_defaults = $orchestrator::params::config_defaults,
7-
$config_override = {},
8-
$config_template = $orchestrator::params::config_template,
9-
$package_ensure = $orchestrator::params::package_ensure,
10-
$package_manage = $orchestrator::params::package_manage,
11-
$package_name = $orchestrator::params::package_name,
12-
$repo_manage = $orchestrator::params::repo_manage,
13-
$service_enable = $orchestrator::params::service_enable,
14-
$service_ensure = $orchestrator::params::service_ensure,
15-
$service_manage = $orchestrator::params::service_manage,
16-
$service_name = $orchestrator::params::service_name,
28+
String $config = $orchestrator::params::config,
29+
Hash[String[1], Any] $config_defaults = $orchestrator::params::config_defaults,
30+
Hash[String[1], Any] $config_override = {},
31+
String $config_template = $orchestrator::params::config_template,
32+
String $package_ensure = $orchestrator::params::package_ensure,
33+
Boolean $package_manage = $orchestrator::params::package_manage,
34+
Array[String[1]] $package_name = $orchestrator::params::package_name,
35+
Boolean $repo_manage = $orchestrator::params::repo_manage,
36+
Boolean $service_enable = $orchestrator::params::service_enable,
37+
String $service_ensure = $orchestrator::params::service_ensure,
38+
Boolean $service_manage = $orchestrator::params::service_manage,
39+
String $service_name = $orchestrator::params::service_name,
1740
) inherits orchestrator::params {
18-
1941
validate_absolute_path($config)
2042
validate_string($config_template)
2143
validate_string($package_ensure)
@@ -27,14 +49,15 @@
2749
validate_bool($service_manage)
2850
validate_string($service_name)
2951

30-
# Using anchor pattern based on known issue:
31-
# http://docs.puppetlabs.com/puppet/2.7/reference/lang_containment.html#known-issues
32-
anchor { 'orchestrator::begin': } ->
33-
class { '::orchestrator::repo': } ->
34-
class { '::orchestrator::install': } ->
35-
class { '::orchestrator::config': } ~>
36-
class { '::orchestrator::my_cnf': } ~>
37-
class { '::orchestrator::service': } ->
38-
anchor { 'orchestrator::end': }
52+
contain orchestrator::repo
53+
contain orchestrator::install
54+
contain orchestrator::config
55+
contain orchestrator::my_cnf
56+
contain orchestrator::service
3957

58+
Class['orchestrator::repo']
59+
-> Class['orchestrator::install']
60+
-> Class['orchestrator::config']
61+
~> Class['orchestrator::my_cnf']
62+
-> Class['orchestrator::service']
4063
}

manifests/install.pp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
#
22
class orchestrator::install inherits orchestrator {
3-
43
if $orchestrator::package_manage {
5-
64
package { $orchestrator::package_name:
75
ensure => $orchestrator::package_ensure,
86
}
9-
107
}
11-
128
}

manifests/params.pp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
#
22
class orchestrator::params {
3-
43
$config = '/etc/orchestrator.conf.json'
54
$config_template = 'orchestrator/orchestrator.conf.json.erb'
65
$package_ensure = 'present'
76
$package_manage = true
8-
$package_name = [ 'orchestrator' ]
7+
$package_name = ['orchestrator']
98
$repo_manage = true
109
$service_enable = true
1110
$service_ensure = 'running'
@@ -74,7 +73,7 @@
7473
'AuthUserHeader' => '',
7574
'PowerAuthUsers' => ['*'],
7675
'ClusterNameToAlias' => {
77-
'127.0.0.1' => 'test suite'
76+
'127.0.0.1' => 'test suite',
7877
},
7978
'AccessTokenUseExpirySeconds' => 60,
8079
'AccessTokenExpiryMinutes' => 1440,
@@ -120,26 +119,26 @@
120119
'RecoveryPeriodBlockSeconds' => 600,
121120
'RecoveryIgnoreHostnameFilters' => [],
122121
'RecoverMasterClusterFilters' => [
123-
'_master_pattern_'
122+
'_master_pattern_',
124123
],
125124
'RecoverIntermediateMasterClusterFilters' => [
126-
'_intermediate_master_pattern_'
125+
'_intermediate_master_pattern_',
127126
],
128127
'OnFailureDetectionProcesses' => [
129-
"echo 'Detected {failureType} on {failureCluster}. Affected replicas: {countSlaves}' >> /tmp/recovery.log"
128+
"echo 'Detected {failureType} on {failureCluster}. Affected replicas: {countSlaves}' >> /tmp/recovery.log",
130129
],
131130
'PreFailoverProcesses' => [
132-
"echo 'Will recover from {failureType} on {failureCluster}' >> /tmp/recovery.log"
131+
"echo 'Will recover from {failureType} on {failureCluster}' >> /tmp/recovery.log",
133132
],
134133
'PostFailoverProcesses' => [
135-
"echo '(for all types) Recovered from {failureType} on {failureCluster}. Failed: {failedHost}:{failedPort}; Successor: {successorHost}:{successorPort}' >> /tmp/recovery.log"
134+
"echo '(for all types) Recovered from {failureType} on {failureCluster}. Failed: {failedHost}:{failedPort}; Successor: {successorHost}:{successorPort}' >> /tmp/recovery.log",
136135
],
137136
'PostUnsuccessfulFailoverProcesses' => [],
138137
'PostMasterFailoverProcesses' => [
139-
"echo 'Recovered from {failureType} on {failureCluster}. Failed: {failedHost}:{failedPort}; Promoted: {successorHost}:{successorPort}' >> /tmp/recovery.log"
138+
"echo 'Recovered from {failureType} on {failureCluster}. Failed: {failedHost}:{failedPort}; Promoted: {successorHost}:{successorPort}' >> /tmp/recovery.log",
140139
],
141140
'PostIntermediateMasterFailoverProcesses' => [
142-
"echo 'Recovered from {failureType} on {failureCluster}. Failed: {failedHost}:{failedPort}; Successor: {successorHost}:{successorPort}' >> /tmp/recovery.log"
141+
"echo 'Recovered from {failureType} on {failureCluster}. Failed: {failedHost}:{failedPort}; Successor: {successorHost}:{successorPort}' >> /tmp/recovery.log",
143142
],
144143
'CoMasterRecoveryMustPromoteOtherCoMaster' => true,
145144
'DetachLostSlavesAfterMasterFailover' => true,

manifests/repo.pp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@
1919
}
2020
}
2121
}
22-
2322
}

manifests/service.pp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
#
22
class orchestrator::service inherits orchestrator {
3-
4-
if ! ($orchestrator::service_ensure in [ 'running', 'stopped' ]) {
3+
if ! ($orchestrator::service_ensure in ['running', 'stopped']) {
54
fail('service_ensure parameter must be running or stopped')
65
}
76

87
if $orchestrator::service_manage == true {
9-
108
service { 'orchestrator':
119
ensure => $orchestrator::service_ensure,
1210
enable => $orchestrator::service_enable,
@@ -15,7 +13,5 @@
1513
name => $orchestrator::service_name,
1614
subscribe => File[$orchestrator::config],
1715
}
18-
1916
}
20-
2117
}

metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"15.04",
4949
"15.10",
5050
"16.04"
51-
]
51+
]
5252
}
5353
],
5454
"requirements": [

0 commit comments

Comments
 (0)