onceover 3.21.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.devcontainer/devcontainer.json +4 -6
- data/.github/dependabot.yml +17 -0
- data/.github/workflows/release.yaml +32 -0
- data/.github/workflows/tests.yaml +30 -4
- data/.gitignore +2 -1
- data/.rubocop.yml +4 -704
- data/.rubocop_todo.yml +828 -0
- data/CHANGELOG.md +1036 -0
- data/Gemfile +9 -0
- data/LICENSE +202 -0
- data/README.md +122 -32
- data/Rakefile +24 -14
- data/cucumber.yml +1 -0
- data/features/auto_vendored.feature +27 -0
- data/features/step_definitions/common.rb +5 -5
- data/features/step_definitions/run.rb +4 -0
- data/features/support/cache_helper.rb +0 -1
- data/features/support/command_helper.rb +0 -2
- data/features/support/controlrepo_helper.rb +0 -2
- data/features/zzz_run.feature +1 -8
- data/lib/onceover/beaker/spec_helper.rb +9 -9
- data/lib/onceover/beaker.rb +9 -12
- data/lib/onceover/cli/run.rb +1 -0
- data/lib/onceover/controlrepo.rb +22 -27
- data/lib/onceover/deploy.rb +30 -3
- data/lib/onceover/group.rb +1 -3
- data/lib/onceover/logger.rb +3 -3
- data/lib/onceover/node.rb +0 -2
- data/lib/onceover/rake_tasks.rb +9 -4
- data/lib/onceover/rspec/formatters.rb +5 -8
- data/lib/onceover/runner.rb +1 -1
- data/lib/onceover/test.rb +2 -3
- data/lib/onceover/testconfig.rb +2 -2
- data/lib/onceover/vendored_modules.rb +186 -0
- data/onceover.gemspec +26 -30
- data/spec/fixtures/controlrepos/caching/spec/factsets/README.md +1 -1
- data/spec/fixtures/controlrepos/caching/spec/pre_conditions/README.md +1 -1
- data/spec/fixtures/controlrepos/factsets/spec/factsets/README.md +1 -1
- data/spec/fixtures/controlrepos/puppet_controlrepo/.atom-build.json +9 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/.gitignore +5 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/.ruby-version +1 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/.travis.yml +13 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/Gemfile +22 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/Jenkinsfile +50 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/Puppetfile +102 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/README.md +4 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/Rakefile +6 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/data/common.yaml +558 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/data/datacenter/melbourne.yaml +12 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/data/datacenter/singapore.yaml +12 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/data/environments/development.yaml +3 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/data/environments/production.yaml +3 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/data/size/vol.large.yaml +27 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/environment.conf +3 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/hiera.yaml +25 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/manifests/site.pp +11 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/code_manager_config_version.rb +19 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/config_version.rb +25 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/config_version.sh +12 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/count_changed_classes.rb +26 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/scripts/get_changed_classes.rb +26 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/console/functions/user/token.pp +10 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/console/manifests/init.pp +14 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/console/manifests/user.pp +35 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/deployments/lib/puppet/functions/deployments/generate.rb +15 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/deployments/plans/signed_deployment.pp +126 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/facts.d/test.sh +2 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/artifactory/config_descriptor.xml +265 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/autosign.sh +23 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/hudson.tasks.Shell.xml +4 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/motd +4 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/files/polar_clock/index.html +198 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/apt.pp +9 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/aws_nodes.pp +54 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base/aws.pp +9 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base/rhel.pp +50 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base/windows/hardening.pp +57 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base/windows.pp +52 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/base.pp +79 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/cd4pe/artifactory.pp +64 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/cd4pe/connection.pp +95 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/cd4pe/haproxy.pp +65 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/cd4pe/replicated.pp +53 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/compile/balancer.pp +28 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/compile/master.pp +19 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/dns/host_record.pp +16 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/dns/server.pp +66 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/docker.pp +5 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/base.pp +43 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/core/database_connection.pp +42 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/core.pp +72 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/ctrl.pp +57 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/database.pp +32 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/eyeunify/exec.pp +11 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/file_sync/client.pp +165 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/file_sync/master_patch.pp +37 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/grafana/dashboard.pp +17 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/haproxy.pp +43 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/init.pp +3 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jenkins/plugins.pp +87 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jenkins.pp +65 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jira/aio.pp +39 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jira/app.pp +27 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/jira/db.pp +25 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/metrics/collectd/compile.pp +82 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/metrics/collectd.pp +28 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/metrics/dashboard.pp +28 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/mysql_server.pp +7 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/nginx.pp +24 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/polar_clock.pp +55 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster/api_auth.pp +82 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster/autosign.pp +33 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster/aws.pp +58 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster/tuning.pp +139 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/puppetmaster.pp +139 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/rvm.pp +13 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/sumologic.pp +11 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/sunburst/windows.pp +104 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/vagrant.pp +25 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/manifests/windows/webserver.pp +27 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/cd4pe/connection_script.sh.epp +110 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/controlrepo_deploy_jenkins_job.xml.epp +51 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/dashboard.json.epp +403 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/jenkins_secret_text.json.epp +1 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/onceover_jenkins_job.xml.epp +51 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/profile/templates/userdata.epp +17 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/cd4pe.pp +29 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/clock.pp +16 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/compile/balancer.pp +5 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/compile/master.pp +5 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/eyeunify/aio.pp +10 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/eyeunify/controller.pp +10 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/eyeunify/database.pp +7 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/eyeunify/exec.pp +6 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/init.pp +3 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/lb.pp +14 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/metrics.pp +5 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/mysql.pp +13 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/windows/base.pp +5 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/site-modules/role/manifests/windows/webserver.pp +6 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/.gitignore +5 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/acceptance/nodesets/onceover-nodes.yml +94 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/classes/test_spec.rb +8 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/CentOS-7.0-64-master-2017.3.2.json +531 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/CentOS-7.0-64-master.json +429 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/CentOS-7.0-64.json +353 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/Windows_Server-2008r2-64.json +184 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/Windows_Server-2012r2-64.json +165 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/hiera.yaml +18 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/matchers/file_matchers.rb +16 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/onceover.yaml +54 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/pre_conditions/site.pp +150 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/r10k.yaml +2 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/shared_examples/helper.rb +91 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/unit/00_parse_spec.rb +76 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/unit/01_linting_spec_example.rb +69 -0
- data/spec/fixtures/controlrepos/puppet_controlrepo/spec/unit/03_puppetfile_spec_example.rb +35 -0
- data/spec/fixtures/controlrepos/vendored/Puppetfile +3 -0
- data/spec/fixtures/controlrepos/vendored/Puppetfile.cron +5 -0
- data/spec/fixtures/controlrepos/vendored/environment.conf +1 -0
- data/spec/fixtures/controlrepos/vendored/site-modules/role/manifests/cron.pp +9 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/augeas_core-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/augeas_core-puppet_agent-8.6.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/cron_core-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/cron_core-puppet_agent-8.6.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/host_core-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/host_core-puppet_agent-8.6.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/mount_core-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/mount_core-puppet_agent-8.6.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/repo_tree-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/repo_tree-puppet_agent-8.6.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/scheduled_task-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/scheduled_task-puppet_agent-8.6.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/selinux_core-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/selinux_core-puppet_agent-8.6.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/sshkeys_core-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/sshkeys_core-puppet_agent-8.6.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/yumrepo_core-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/yumrepo_core-puppet_agent-8.6.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/zfs_core-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/zfs_core-puppet_agent-8.6.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/zone_core-puppet_agent-7.30.0.json +1 -0
- data/spec/fixtures/controlrepos/vendored/spec/vendored_modules/zone_core-puppet_agent-8.6.0.json +1 -0
- data/spec/onceover/controlrepo_spec.rb +1 -1
- data/templates/factsets_README.md.erb +1 -1
- data/templates/pre_conditions_README.md.erb +1 -1
- data/templates/spec_helper.rb.erb +0 -2
- data/templates/test_spec.rb.erb +3 -0
- metadata +173 -68
- data/.gitmodules +0 -4
data/spec/fixtures/controlrepos/puppet_controlrepo/spec/factsets/Windows_Server-2012r2-64.json
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
{
|
2
|
+
"name": "win-e5k8tm30719",
|
3
|
+
"values": {
|
4
|
+
"choco_install_path": "C:\\choco",
|
5
|
+
"agent_specified_environment": "production",
|
6
|
+
"architecture": "x64",
|
7
|
+
"dhcp_servers": {
|
8
|
+
"Ethernet": "10.0.2.2",
|
9
|
+
"system": "10.0.2.2"
|
10
|
+
},
|
11
|
+
"dmi": {
|
12
|
+
"manufacturer": "innotek GmbH",
|
13
|
+
"product": {
|
14
|
+
"name": "VirtualBox",
|
15
|
+
"serial_number": "0"
|
16
|
+
}
|
17
|
+
},
|
18
|
+
"env_windows_installdir": "C:\\Program Files\\Puppet Labs\\Puppet",
|
19
|
+
"facterversion": "3.1.1",
|
20
|
+
"fqdn": "WIN-E5K8TM30719",
|
21
|
+
"hardwareisa": "x64",
|
22
|
+
"hardwaremodel": "x86_64",
|
23
|
+
"hostname": "WIN-E5K8TM30719",
|
24
|
+
"id": "WIN-E5K8TM30719\\vagrant",
|
25
|
+
"identity": {
|
26
|
+
"user": "WIN-E5K8TM30719\\vagrant"
|
27
|
+
},
|
28
|
+
"interfaces": "Ethernet",
|
29
|
+
"ipaddress": "10.0.2.15",
|
30
|
+
"ipaddress6": "fe80::a180:36e0:3a6e:1005%12",
|
31
|
+
"ipaddress6_Ethernet": "fe80::a180:36e0:3a6e:1005%12",
|
32
|
+
"ipaddress_Ethernet": "10.0.2.15",
|
33
|
+
"is_virtual": true,
|
34
|
+
"kernel": "windows",
|
35
|
+
"kernelmajversion": "6.3",
|
36
|
+
"kernelrelease": "6.3.9600",
|
37
|
+
"kernelversion": "6.3.9600",
|
38
|
+
"macaddress": "08:00:27:81:38:FA",
|
39
|
+
"macaddress_Ethernet": "08:00:27:81:38:FA",
|
40
|
+
"manufacturer": "innotek GmbH",
|
41
|
+
"memory": {
|
42
|
+
"system": {
|
43
|
+
"available": "1.42 GiB",
|
44
|
+
"available_bytes": 1521610752,
|
45
|
+
"capacity": "29.13%",
|
46
|
+
"total": "2.00 GiB",
|
47
|
+
"total_bytes": 2147012608,
|
48
|
+
"used": "596.43 MiB",
|
49
|
+
"used_bytes": 625401856
|
50
|
+
}
|
51
|
+
},
|
52
|
+
"memoryfree": "1.42 GiB",
|
53
|
+
"memoryfree_mb": 1451.12109375,
|
54
|
+
"memorysize": "2.00 GiB",
|
55
|
+
"memorysize_mb": 2047.55078125,
|
56
|
+
"mtu_Ethernet": 1500,
|
57
|
+
"netmask": "255.255.255.0",
|
58
|
+
"netmask6": "ffff:ffff:ffff:ffff::",
|
59
|
+
"netmask6_Ethernet": "ffff:ffff:ffff:ffff::",
|
60
|
+
"netmask_Ethernet": "255.255.255.0",
|
61
|
+
"network": "10.0.2.0",
|
62
|
+
"network6": "fe80::%12",
|
63
|
+
"network6_Ethernet": "fe80::%12",
|
64
|
+
"network_Ethernet": "10.0.2.0",
|
65
|
+
"networking": {
|
66
|
+
"dhcp": "10.0.2.2",
|
67
|
+
"fqdn": "WIN-E5K8TM30719",
|
68
|
+
"hostname": "WIN-E5K8TM30719",
|
69
|
+
"interfaces": {
|
70
|
+
"Ethernet": {
|
71
|
+
"bindings": [
|
72
|
+
{
|
73
|
+
"address": "10.0.2.15",
|
74
|
+
"netmask": "255.255.255.0",
|
75
|
+
"network": "10.0.2.0"
|
76
|
+
}
|
77
|
+
],
|
78
|
+
"bindings6": [
|
79
|
+
{
|
80
|
+
"address": "fe80::a180:36e0:3a6e:1005%12",
|
81
|
+
"netmask": "ffff:ffff:ffff:ffff::",
|
82
|
+
"network": "fe80::%12"
|
83
|
+
}
|
84
|
+
],
|
85
|
+
"dhcp": "10.0.2.2",
|
86
|
+
"ip": "10.0.2.15",
|
87
|
+
"ip6": "fe80::a180:36e0:3a6e:1005%12",
|
88
|
+
"mac": "08:00:27:81:38:FA",
|
89
|
+
"mtu": 1500,
|
90
|
+
"netmask": "255.255.255.0",
|
91
|
+
"netmask6": "ffff:ffff:ffff:ffff::",
|
92
|
+
"network": "10.0.2.0",
|
93
|
+
"network6": "fe80::%12"
|
94
|
+
}
|
95
|
+
},
|
96
|
+
"ip": "10.0.2.15",
|
97
|
+
"ip6": "fe80::a180:36e0:3a6e:1005%12",
|
98
|
+
"mac": "08:00:27:81:38:FA",
|
99
|
+
"mtu": 1500,
|
100
|
+
"netmask": "255.255.255.0",
|
101
|
+
"netmask6": "ffff:ffff:ffff:ffff::",
|
102
|
+
"network": "10.0.2.0",
|
103
|
+
"network6": "fe80::%12",
|
104
|
+
"primary": "Ethernet"
|
105
|
+
},
|
106
|
+
"operatingsystem": "windows",
|
107
|
+
"operatingsystemmajrelease": "2012 R2",
|
108
|
+
"operatingsystemrelease": "2012 R2",
|
109
|
+
"os": {
|
110
|
+
"architecture": "x64",
|
111
|
+
"family": "windows",
|
112
|
+
"hardware": "x86_64",
|
113
|
+
"name": "windows",
|
114
|
+
"release": {
|
115
|
+
"full": "2012 R2",
|
116
|
+
"major": "2012 R2"
|
117
|
+
},
|
118
|
+
"windows": {
|
119
|
+
"system32": "C:\\Windows\\system32"
|
120
|
+
}
|
121
|
+
},
|
122
|
+
"osfamily": "windows",
|
123
|
+
"path": "C:/Program Files/Puppet Labs/Puppet/facter/bin;C:\\Program Files\\Puppet Labs\\Puppet\\puppet\\bin;C:\\Program Files\\Puppet Labs\\Puppet\\facter\\bin;C:\\Program Files\\Puppet Labs\\Puppet\\hiera\\bin;C:\\Program Files\\Puppet Labs\\Puppet\\mcollective\\bin;C:\\Program Files\\Puppet Labs\\Puppet\\bin;C:\\Program Files\\Puppet Labs\\Puppet\\sys\\ruby\\bin;C:\\Program Files\\Puppet Labs\\Puppet\\sys\\tools\\bin;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\Git\\cmd;C:\\Program Files (x86)\\Git\\bin;C:\\Program Files\\Puppet Labs\\Puppet\\bin",
|
124
|
+
"physicalprocessorcount": 1,
|
125
|
+
"processor0": "Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz",
|
126
|
+
"processorcount": 1,
|
127
|
+
"processors": {
|
128
|
+
"count": 1,
|
129
|
+
"isa": "x64",
|
130
|
+
"models": [
|
131
|
+
"Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz"
|
132
|
+
],
|
133
|
+
"physicalcount": 1
|
134
|
+
},
|
135
|
+
"productname": "VirtualBox",
|
136
|
+
"puppetversion": "4.2.3",
|
137
|
+
"ruby": {
|
138
|
+
"platform": "x64-mingw32",
|
139
|
+
"sitedir": "C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/site_ruby/2.1.0",
|
140
|
+
"version": "2.1.7"
|
141
|
+
},
|
142
|
+
"rubyplatform": "x64-mingw32",
|
143
|
+
"rubysitedir": "C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/site_ruby/2.1.0",
|
144
|
+
"rubyversion": "2.1.7",
|
145
|
+
"serialnumber": "0",
|
146
|
+
"system32": "C:\\Windows\\system32",
|
147
|
+
"system_uptime": {
|
148
|
+
"days": 0,
|
149
|
+
"hours": 0,
|
150
|
+
"seconds": 287,
|
151
|
+
"uptime": "0:04 hours"
|
152
|
+
},
|
153
|
+
"timezone": "Coordinated Universal Time",
|
154
|
+
"uptime": "0:04 hours",
|
155
|
+
"uptime_days": 0,
|
156
|
+
"uptime_hours": 0,
|
157
|
+
"uptime_seconds": 287,
|
158
|
+
"virtual": "virtualbox",
|
159
|
+
"clientcert": "win-e5k8tm30719",
|
160
|
+
"clientversion": "4.2.3",
|
161
|
+
"clientnoop": false
|
162
|
+
},
|
163
|
+
"timestamp": "2015-11-19T01:47:05.215450000+00:00",
|
164
|
+
"expiration": "2015-11-19T02:17:05.215450000+00:00"
|
165
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
version: 5
|
3
|
+
defaults: # Used for any hierarchy level that omits these keys.
|
4
|
+
data_hash: yaml_data
|
5
|
+
datadir: ../data
|
6
|
+
|
7
|
+
hierarchy:
|
8
|
+
- name: "Per-node data" # Human-readable name.
|
9
|
+
path: "nodes/%{trusted.certname}.yaml" # File path, relative to datadir.
|
10
|
+
# ^^^ IMPORTANT: include the file extension!
|
11
|
+
- name: "Per-Environment"
|
12
|
+
path: "environments/%{agent_specified_environment}.yaml"
|
13
|
+
|
14
|
+
- name: "Per-Datacenter"
|
15
|
+
path: "datacenter/%{datacenter}.yaml"
|
16
|
+
|
17
|
+
- name: "Common Data"
|
18
|
+
path: "common.yaml"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
RSpec::Matchers.define :satisfy_file_resource_requirements do
|
2
|
+
match do |catalog|
|
3
|
+
@missing_param = catalogue.resources.map do |resource|
|
4
|
+
next if !(resource.type == 'File')
|
5
|
+
if resource[:mode]
|
6
|
+
if resource[:mode] =~ /777|\d.*7$/
|
7
|
+
"Found use of unsafe file mode for file #{resource}, mode: #{resource[:mode]}"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end.compact
|
11
|
+
@missing_param.empty?
|
12
|
+
end
|
13
|
+
failure_message do |str|
|
14
|
+
@missing_param.join("\n")
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
classes:
|
2
|
+
- "/role::/"
|
3
|
+
|
4
|
+
nodes:
|
5
|
+
- CentOS-7.0-64
|
6
|
+
- CentOS-7.0-64-master
|
7
|
+
- CentOS-7.0-64-openstack
|
8
|
+
- Windows_Server-2008r2-64
|
9
|
+
- Windows_Server-2012r2-64
|
10
|
+
|
11
|
+
node_groups:
|
12
|
+
centos:
|
13
|
+
- CentOS-7.0-64
|
14
|
+
- CentOS-7.0-64-master
|
15
|
+
windows:
|
16
|
+
- Windows_Server-2008r2-64
|
17
|
+
- Windows_Server-2012r2-64
|
18
|
+
master:
|
19
|
+
- CentOS-7.0-64-master
|
20
|
+
|
21
|
+
class_groups:
|
22
|
+
master_classes:
|
23
|
+
- "role::compile::balancer"
|
24
|
+
- "role::compile::master"
|
25
|
+
windows_classes:
|
26
|
+
- /windows/
|
27
|
+
linux_classes:
|
28
|
+
include: "all_classes"
|
29
|
+
exclude: "windows_classes"
|
30
|
+
|
31
|
+
test_matrix:
|
32
|
+
# Main spec tests for all CentOS roles
|
33
|
+
- centos:
|
34
|
+
classes:
|
35
|
+
include: "linux_classes"
|
36
|
+
exclude: "master_classes"
|
37
|
+
tests: "spec"
|
38
|
+
# Master based spec tests
|
39
|
+
- master:
|
40
|
+
classes: "master_classes"
|
41
|
+
tests: "spec"
|
42
|
+
tags: "master"
|
43
|
+
|
44
|
+
functions:
|
45
|
+
puppetdb_query:
|
46
|
+
returns: []
|
47
|
+
pe_compiling_server_version:
|
48
|
+
returns: "2019.2.1"
|
49
|
+
pe_build_version:
|
50
|
+
returns: "2019.2.1"
|
51
|
+
pe_empty:
|
52
|
+
returns: false
|
53
|
+
pe_join:
|
54
|
+
returns: ""
|
@@ -0,0 +1,150 @@
|
|
1
|
+
# We are not going to actually have this service anywhere on our servers but
|
2
|
+
# our code needs to refresh it. This is to trck puppet into doing nothing
|
3
|
+
|
4
|
+
# $servername = 'somemaster.puppetlabs.com' # Workaround for the lack of a master
|
5
|
+
$choco_install_path = 'C:\\foo'
|
6
|
+
$chocolateyversion = '0.10.10'
|
7
|
+
unless $concat_basedir {
|
8
|
+
$concat_basedir = '/opt/puppetlabs/puppet/share/concat' # Workaround for lack of concat facts
|
9
|
+
}
|
10
|
+
service { 'pe-puppetserver':
|
11
|
+
ensure => 'running',
|
12
|
+
enable => false,
|
13
|
+
hasrestart => false, # Force Puppet to use start and stop to restart
|
14
|
+
start => 'echo "Start"', # This will always work
|
15
|
+
stop => 'echo "Stop"', # This will also always work
|
16
|
+
hasstatus => false, # Force puppet to use our command for status
|
17
|
+
status => 'echo "Status"', # This will always exit 0 and therefor Puppet will think the service is running
|
18
|
+
provider => 'base',
|
19
|
+
}
|
20
|
+
|
21
|
+
service { 'pe-console-services':
|
22
|
+
ensure => 'running',
|
23
|
+
enable => true,
|
24
|
+
}
|
25
|
+
|
26
|
+
package { 'pe-puppetserver':
|
27
|
+
ensure => present,
|
28
|
+
}
|
29
|
+
|
30
|
+
user { 'puppet':
|
31
|
+
ensure => present,
|
32
|
+
}
|
33
|
+
|
34
|
+
group { 'puppet':
|
35
|
+
ensure => present,
|
36
|
+
}
|
37
|
+
|
38
|
+
$gnupg_installed = true
|
39
|
+
|
40
|
+
class puppet_enterprise (
|
41
|
+
$puppet_master_host = 'puppet-server',
|
42
|
+
) {}
|
43
|
+
include puppet_enterprise
|
44
|
+
class puppet_enterprise::params (
|
45
|
+
$localcacert = '',
|
46
|
+
) {}
|
47
|
+
include puppet_enterprise::params
|
48
|
+
class pe_repo::platform::windows_i386 {}
|
49
|
+
class pe_repo::platform::windows_x86_64 {}
|
50
|
+
class pe_repo::platform::el_6_x86_64 {}
|
51
|
+
define puppet_enterprise::trapperkeeper::pe_service () {}
|
52
|
+
define puppet_enterprise::trapperkeeper::bootstrap_cfg ($namespace, $container) { }
|
53
|
+
class puppet_enterprise::master::file_sync (
|
54
|
+
$puppet_master_host,
|
55
|
+
$master_of_masters_certname,
|
56
|
+
$localcacert,
|
57
|
+
$puppetserver_jruby_puppet_master_code_dir,
|
58
|
+
$puppetserver_webserver_ssl_port,
|
59
|
+
$storage_service_disabled,
|
60
|
+
) {}
|
61
|
+
define pe_hocon_setting ($path, $value, $setting, $type = '') {}
|
62
|
+
define puppet_enterprise::trapperkeeper::java_args ($java_args, $enable_gc_logging) {}
|
63
|
+
define puppet_enterprise::trapperkeeper::webserver_settings ($container,$ssl_listen_address,$ssl_listen_port,$default_server = false) {}
|
64
|
+
class pe_postgresql::globals (
|
65
|
+
$user = undef,
|
66
|
+
$group = undef,
|
67
|
+
$client_package_name = undef,
|
68
|
+
$contrib_package_name = undef,
|
69
|
+
$server_package_name = undef,
|
70
|
+
$service_name = undef,
|
71
|
+
$default_database = undef,
|
72
|
+
$version = undef,
|
73
|
+
$bindir = undef,
|
74
|
+
$datadir = undef,
|
75
|
+
$confdir = undef,
|
76
|
+
$psql_path = undef,
|
77
|
+
$needs_initdb = undef,
|
78
|
+
$pg_hba_conf_defaults = undef,
|
79
|
+
) {}
|
80
|
+
class pe_postgresql::server (
|
81
|
+
$listen_addresses = undef,
|
82
|
+
$ip_mask_allow_all_users = undef,
|
83
|
+
$package_ensure = undef,
|
84
|
+
) {}
|
85
|
+
class pe_postgresql::server::contrib (
|
86
|
+
$package_ensure = undef,
|
87
|
+
) {}
|
88
|
+
class pe_postgresql::client (
|
89
|
+
$package_ensure = undef,
|
90
|
+
) {}
|
91
|
+
define pe_postgresql::server::database (
|
92
|
+
$owner = undef,
|
93
|
+
) {}
|
94
|
+
define pe_postgresql::server::tablespace (
|
95
|
+
$location = undef,
|
96
|
+
) {}
|
97
|
+
define pe_postgresql::server::db (
|
98
|
+
$user = undef,
|
99
|
+
$password = undef,
|
100
|
+
$tablespace = undef,
|
101
|
+
) {}
|
102
|
+
define pe_concat (
|
103
|
+
$owner = undef,
|
104
|
+
$group = undef,
|
105
|
+
$force = undef,
|
106
|
+
$mode = undef,
|
107
|
+
$warn = undef,
|
108
|
+
$ensure_newline = undef,
|
109
|
+
) {}
|
110
|
+
define pe_postgresql::server::pg_hba_rule (
|
111
|
+
$database = undef,
|
112
|
+
$user = undef,
|
113
|
+
$type = undef,
|
114
|
+
$auth_method = undef,
|
115
|
+
$order = undef,
|
116
|
+
) {}
|
117
|
+
define pe_postgresql::server::config_entry (
|
118
|
+
$value = undef,
|
119
|
+
) {}
|
120
|
+
define puppet_enterprise::pg::cert_whitelist_entry (
|
121
|
+
$user = undef,
|
122
|
+
$database = undef,
|
123
|
+
$allowed_client_certname = undef,
|
124
|
+
$pg_ident_conf_path = undef,
|
125
|
+
$ip_mask_allow_all_users_ssl = undef,
|
126
|
+
$ipv6_mask_allow_all_users_ssl = undef,
|
127
|
+
) {}
|
128
|
+
class pe_postgresql::server::install {}
|
129
|
+
include pe_postgresql::server::install
|
130
|
+
class pe_postgresql::server::initdb {}
|
131
|
+
include pe_postgresql::server::initdb
|
132
|
+
class pe_postgresql::server::reload {}
|
133
|
+
include pe_postgresql::server::reload
|
134
|
+
if $onceover_class == 'role::cd4pe' {
|
135
|
+
package { 'postgresql-server': }
|
136
|
+
}
|
137
|
+
|
138
|
+
define pe_puppet_authorization::rule (
|
139
|
+
$path = undef,
|
140
|
+
$match_request_path = undef,
|
141
|
+
$match_request_type = undef,
|
142
|
+
$match_request_method = undef,
|
143
|
+
$allow = undef,
|
144
|
+
$allow_unauthenticated = undef,
|
145
|
+
$sort_order = undef,
|
146
|
+
) {}
|
147
|
+
|
148
|
+
function pe_union ($param, $param2) { [$param, $param2] }
|
149
|
+
function pe_sort ($param) { [1,2,3] }
|
150
|
+
function pe_unique ($param) { [1,2,3] }
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
shared_examples_for 'test_linux' do |fact_set|
|
4
|
+
|
5
|
+
describe "SOE Checks" do
|
6
|
+
|
7
|
+
it do
|
8
|
+
is_expected.to contain_package('tree').with(
|
9
|
+
'ensure' => 'latest',
|
10
|
+
)
|
11
|
+
end
|
12
|
+
|
13
|
+
it do
|
14
|
+
is_expected.to contain_package('vim').with(
|
15
|
+
'ensure' => 'latest',
|
16
|
+
)
|
17
|
+
end
|
18
|
+
|
19
|
+
it do
|
20
|
+
is_expected.to contain_package('git').with(
|
21
|
+
'ensure' => 'latest',
|
22
|
+
)
|
23
|
+
end
|
24
|
+
|
25
|
+
it do
|
26
|
+
is_expected.to contain_package('htop').with(
|
27
|
+
'ensure' => 'latest',
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
it do
|
32
|
+
is_expected.to contain_package('zlib').with(
|
33
|
+
'ensure' => 'latest',
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
37
|
+
it do
|
38
|
+
is_expected.to contain_package('zlib-devel').with(
|
39
|
+
'ensure' => 'latest',
|
40
|
+
)
|
41
|
+
end
|
42
|
+
|
43
|
+
it do
|
44
|
+
is_expected.to contain_package('jq').with(
|
45
|
+
'ensure' => 'latest',
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
it do
|
50
|
+
is_expected.to contain_package('ruby').with(
|
51
|
+
'ensure' => 'latest',
|
52
|
+
)
|
53
|
+
end
|
54
|
+
|
55
|
+
it do
|
56
|
+
is_expected.to contain_package('ruby-devel').with(
|
57
|
+
'ensure' => 'latest',
|
58
|
+
)
|
59
|
+
end
|
60
|
+
|
61
|
+
it do
|
62
|
+
is_expected.to contain_package('multitail').with(
|
63
|
+
'ensure' => 'latest',
|
64
|
+
)
|
65
|
+
end
|
66
|
+
|
67
|
+
it do
|
68
|
+
is_expected.to contain_package('haveged').with(
|
69
|
+
'ensure' => 'latest',
|
70
|
+
)
|
71
|
+
end
|
72
|
+
|
73
|
+
it do
|
74
|
+
is_expected.to contain_package('cmake').with(
|
75
|
+
'ensure' => 'latest',
|
76
|
+
)
|
77
|
+
end
|
78
|
+
|
79
|
+
it do
|
80
|
+
is_expected.to contain_package('tmux').with(
|
81
|
+
'ensure' => 'latest',
|
82
|
+
)
|
83
|
+
end
|
84
|
+
|
85
|
+
it do
|
86
|
+
is_expected.to contain_package('unzip').with(
|
87
|
+
'ensure' => 'latest',
|
88
|
+
)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
#
|
2
|
+
# This set of tests is for syntax validation, It runs through all of the
|
3
|
+
# Puppet, Ruby and ERB code in the repositories and validates it with it's
|
4
|
+
# relevant validator.
|
5
|
+
#
|
6
|
+
# If we want to change the scope of these tests the following variables can be
|
7
|
+
# modified to change which files are in scope:
|
8
|
+
# - puppet_search_path
|
9
|
+
# - ruby_search_path
|
10
|
+
# - erb_search_path
|
11
|
+
# - epp_search_path
|
12
|
+
#
|
13
|
+
# All paths are relative the the .onceover temporary directory which is created
|
14
|
+
# as part of a normal Onceover run
|
15
|
+
require 'puppet'
|
16
|
+
|
17
|
+
# Tell Puppet where to find our code. This is relative to the .onceover directory
|
18
|
+
Puppet.initialize_settings(['--codedir ./etc/puppetlabs/code'])
|
19
|
+
|
20
|
+
# Create a Puppet environment that we can interact with
|
21
|
+
env = Puppet.lookup(:current_environment)
|
22
|
+
loaders = Puppet::Pops::Loaders.new(env)
|
23
|
+
|
24
|
+
# Where to search fort files to syntax validate
|
25
|
+
puppet_search_path = './etc/puppetlabs/code/environments/production/site-modules/*/{manifests,functions,types}/**/*.pp'
|
26
|
+
ruby_search_path = './etc/puppetlabs/code/environments/production/site-modules/*/lib/**/*.rb'
|
27
|
+
erb_search_path = './etc/puppetlabs/code/environments/production/site-modules/**/*.erb'
|
28
|
+
epp_search_path = './etc/puppetlabs/code/environments/production/site-modules/**/*.epp'
|
29
|
+
|
30
|
+
describe "When checking Puppet syntax", syntax: true do
|
31
|
+
Dir[puppet_search_path].each do |manifest|
|
32
|
+
context manifest do
|
33
|
+
it "should be valid Puppet syntax" do
|
34
|
+
Puppet.override({ :loaders => loaders }, 'For Puppet parser validate') do
|
35
|
+
validation_environment = env.override_with(:manifest => manifest)
|
36
|
+
expect(validation_environment.check_for_reparse).to be_nil
|
37
|
+
expect(validation_environment.known_resource_types.clear).to match_array []
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "When checking Ruby syntax", syntax: true do
|
45
|
+
Dir[ruby_search_path].each do |ruby_file|
|
46
|
+
context ruby_file do
|
47
|
+
it "should be valid Ruby syntax" do
|
48
|
+
expect(`ruby -c #{ruby_file}`).to match(/Syntax OK/) unless ruby_file =~ /spec\/fixtures/
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe "When checking ERB syntax", syntax: true do
|
55
|
+
Dir[erb_search_path].each do |template|
|
56
|
+
context template do
|
57
|
+
it "should be valid ERB syntax" do
|
58
|
+
expect(`erb -P -x -T '-' #{template} | ruby -c`).to match(/Syntax OK/)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe "When checking EPP syntax", syntax: true do
|
65
|
+
before(:all) do
|
66
|
+
@parser = Puppet::Pops::Parser::EvaluatingParser::EvaluatingEppParser.new()
|
67
|
+
end
|
68
|
+
|
69
|
+
Dir[epp_search_path].each do |template|
|
70
|
+
context template do
|
71
|
+
it "should be valid EPP syntax" do
|
72
|
+
expect{@parser.parse_file(template)}.not_to raise_error
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
#
|
2
|
+
# The following set of tests is designed to enforce style in the Puppet code.
|
3
|
+
# This may be coming from the Puppet style guide as in the puppet-lint tests
|
4
|
+
# or may be arbitrarily defined. Anything that relates to how the
|
5
|
+
# code is written should go in this file
|
6
|
+
#
|
7
|
+
require 'puppet-lint'
|
8
|
+
|
9
|
+
# Create a single linter object to save time
|
10
|
+
linter = PuppetLint.new
|
11
|
+
|
12
|
+
# --- Begin Settings ---
|
13
|
+
#
|
14
|
+
manifest_search_path = './etc/puppetlabs/code/environments/production/site/*/manifests/**/*.pp'
|
15
|
+
|
16
|
+
# Options passed to puppet-lint
|
17
|
+
# See http://puppet-lint.com/checks/
|
18
|
+
linter.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]
|
19
|
+
# I would like to enable this soon
|
20
|
+
linter.configuration.send('disable_documentation')
|
21
|
+
# We just don't care about this stuff
|
22
|
+
linter.configuration.send('disable_80chars')
|
23
|
+
linter.configuration.send('disable_140chars')
|
24
|
+
# linter.configuration.send('disable_names_containing_uppercase')
|
25
|
+
#linter.configuration.send('disable_double_quoted_strings')
|
26
|
+
#linter.configuration.send('disable_variable_scope')
|
27
|
+
#linter.configuration.send('disable_slash_comments')
|
28
|
+
#linter.configuration.send('disable_autoloader_layout')
|
29
|
+
#linter.configuration.send('disable_star_comments')
|
30
|
+
#linter.configuration.send('disable_variables_not_enclosed')
|
31
|
+
#linter.configuration.send('disable_arrow_alignment')
|
32
|
+
#linter.configuration.send('disable_trailing_whitespace')
|
33
|
+
# At the moment this is broken, identifying local variables
|
34
|
+
# in iterations as top level. Can surround the code block
|
35
|
+
# with the following comments:
|
36
|
+
# lint:ignore:variable_scope
|
37
|
+
# lint:endignore
|
38
|
+
|
39
|
+
# Set up the Linter error message, this is not normally required but
|
40
|
+
# in this instance it was cutting off useful information so we are
|
41
|
+
# creating a custom error message/
|
42
|
+
def format_error(problems)
|
43
|
+
problems.map do |problem|
|
44
|
+
problem.keep_if do |k,v|
|
45
|
+
[:message,:line,:column,:check].include?(k)
|
46
|
+
end
|
47
|
+
end.to_yaml
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
# --- End Settings ---
|
52
|
+
require 'yaml'
|
53
|
+
|
54
|
+
describe "When checking Puppet Style" do
|
55
|
+
Dir[manifest_search_path].each do |manifest|
|
56
|
+
context manifest do
|
57
|
+
it "should follow the style guide" do
|
58
|
+
linter.file = manifest
|
59
|
+
expect(linter.run).to be nil
|
60
|
+
|
61
|
+
# Get all of the problems that were not ignored
|
62
|
+
problems = linter.problems.reject {|r| r[:kind] == :ignored }
|
63
|
+
|
64
|
+
# Expect there to be no problems, but also format the errors nicely
|
65
|
+
expect(problems).to match_array([]), format_error(problems)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#
|
2
|
+
# This set of tests ensures that the Puppetfile has been written correctly
|
3
|
+
# Anything relating to the syntax or content of the Puppetfile should be
|
4
|
+
# in this file
|
5
|
+
#
|
6
|
+
require 'r10k/puppetfile'
|
7
|
+
|
8
|
+
describe "The Puppetfile" do
|
9
|
+
# Load in the Puppetfile using the r10k gem
|
10
|
+
# This handles all of the parsing for us so that we don't need to write
|
11
|
+
# complicated regular expressions or anything like that.
|
12
|
+
@puppetfile = R10K::Puppetfile.new('./etc/puppetlabs/code/environments/production')
|
13
|
+
@puppetfile.load!
|
14
|
+
|
15
|
+
@puppetfile.modules.each do |current_module|
|
16
|
+
describe current_module.name do
|
17
|
+
#require 'pry'
|
18
|
+
#binding.pry
|
19
|
+
it "should be pinned to a version" do
|
20
|
+
if current_module.is_a? R10K::Module::Git
|
21
|
+
# It should be pinned to a version or commit
|
22
|
+
semver_regex = /^v?\d+\.?\d*\.*\w*$/
|
23
|
+
commit_regex = /^[0-9a-f]{7,40}$/
|
24
|
+
expect(current_module.version).to match Regexp.union(semver_regex,commit_regex)
|
25
|
+
else
|
26
|
+
# If it's a forge module it should not be pinned to latest
|
27
|
+
expect(current_module.instance_variable_get('@args')).not_to eq(:latest)
|
28
|
+
# It should also not have blank args
|
29
|
+
expect(current_module.instance_variable_get('@args')).not_to eq(nil)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|