onceover 3.17.2 → 3.19.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitattributes +2 -0
- data/.github/workflows/tests.yaml +40 -0
- data/.rubocop.yml +20 -2
- data/Gemfile +0 -13
- data/README.md +201 -110
- data/Rakefile +8 -5
- data/factsets/CentOS-8.3.2011-64.json +485 -0
- data/factsets/Debian-10.4-64.json +476 -0
- data/factsets/Debian-8.11-64.json +480 -0
- data/factsets/Debian-9.12-64.json +476 -0
- data/factsets/Ubuntu-20.04-64.json +504 -0
- data/factsets/Windows_Server-2008r2-64.json +184 -183
- data/factsets/Windows_Server-2012r2-64.json +165 -164
- data/factsets/windows-10-64.json +104 -103
- data/features/cache.feature +1 -1
- data/features/step_definitions/cache.rb +4 -4
- data/features/step_definitions/common.rb +38 -10
- data/features/step_definitions/init.rb +2 -2
- data/features/windows.feature +5 -0
- data/features/zzz_run.feature +22 -3
- data/lib/onceover/controlrepo.rb +10 -4
- data/lib/onceover/deploy.rb +3 -1
- data/lib/onceover/group.rb +3 -1
- data/lib/onceover/rspec/formatters.rb +6 -1
- data/lib/onceover/runner.rb +7 -6
- data/lib/onceover/test.rb +3 -2
- data/lib/onceover/testconfig.rb +28 -5
- data/onceover.gemspec +5 -2
- data/spec/fixtures/controlrepos/basic/manifests_alternate/site.pp +2 -0
- data/spec/fixtures/controlrepos/caching/Puppetfile +17 -17
- data/spec/fixtures/controlrepos/caching/manifests/site.pp +1 -0
- data/spec/fixtures/controlrepos/custom_puppetfile/Puppetfile.custom +3 -0
- data/spec/fixtures/controlrepos/custom_puppetfile/environment.conf +7 -0
- data/spec/fixtures/controlrepos/windows/Puppetfile +6 -1
- data/spec/fixtures/controlrepos/windows/site-modules/role/manifests/choco.pp +9 -0
- data/templates/test_spec.rb.erb +1 -1
- metadata +75 -18
- data/.travis.yml +0 -19
- data/appveyor.yml +0 -38
data/factsets/windows-10-64.json
CHANGED
@@ -1,103 +1,104 @@
|
|
1
|
-
{
|
2
|
-
"name": "vagrant-hb9g3rd.lan.asio",
|
3
|
-
"values": {
|
4
|
-
"puppetversion": "6.0.2",
|
5
|
-
"puppet_inventory_metadata": {
|
6
|
-
"packages": {
|
7
|
-
"collection_enabled": false,
|
8
|
-
"last_collection_time": "0.0s"
|
9
|
-
}
|
10
|
-
},
|
11
|
-
"package_provider": "windows",
|
12
|
-
"pe_concat_basedir": "C:/ProgramData/PuppetLabs/puppet/cache/pe_concat",
|
13
|
-
"is_pe": false,
|
14
|
-
"platform_symlink_writable": false,
|
15
|
-
"puppet_files_dir_present": false,
|
16
|
-
"puppet_vardir": "C:/ProgramData/PuppetLabs/puppet/cache",
|
17
|
-
"puppet_environmentpath": "C:/ProgramData/PuppetLabs/code/environments",
|
18
|
-
"puppet_server": "pe-puppet.localdomain",
|
19
|
-
"service_provider": "windows",
|
20
|
-
"staging_http_get": "curl",
|
21
|
-
"common_appdata": "C:\\ProgramData",
|
22
|
-
"architecture": "x64",
|
23
|
-
"kernel": "windows",
|
24
|
-
"virtual": "vmware",
|
25
|
-
"is_virtual": true,
|
26
|
-
"hardwaremodel": "x64",
|
27
|
-
"operatingsystem": "windows",
|
28
|
-
"os": {
|
29
|
-
"name": "windows",
|
30
|
-
"family": "windows",
|
31
|
-
"release": {
|
32
|
-
"major": "10",
|
33
|
-
"full": "10"
|
34
|
-
}
|
35
|
-
},
|
36
|
-
"facterversion": "2.5.1",
|
37
|
-
"fqdn": "VAGRANT-HB9G3RD",
|
38
|
-
"hostname": "VAGRANT-HB9G3RD",
|
39
|
-
"id": "vagrant-hb9g3rd\\vagrant",
|
40
|
-
"interfaces": "Ethernet0_2",
|
41
|
-
"ipaddress_ethernet0_2": "192.168.43.174",
|
42
|
-
"ipaddress6_ethernet0_2": "fd72:b3ab:b8dd:0:f563:fac2:928c:6aa",
|
43
|
-
"macaddress_ethernet0_2": "00:0C:29:A3:53:54",
|
44
|
-
"netmask_ethernet0_2": "255.255.255.0",
|
45
|
-
"mtu_ethernet0_2": 0,
|
46
|
-
"ipaddress": "192.168.43.174",
|
47
|
-
"ipaddress6": "fd72:b3ab:b8dd:0:f563:fac2:928c:6aa",
|
48
|
-
"kernelmajversion": "10.0",
|
49
|
-
"kernelrelease": "10.0.17134",
|
50
|
-
"kernelversion": "10.0.17134",
|
51
|
-
"macaddress": "00:0C:29:A3:53:54",
|
52
|
-
"manufacturer": "Phoenix Technologies LTD",
|
53
|
-
"serialnumber": "VMware-56 4d 36 2e 2e a4 81 f9-0d 05 ae d0 e5 a3 53 54",
|
54
|
-
"productname": "VMware Virtual Platform",
|
55
|
-
"memorysize": "4.00 GB",
|
56
|
-
"memoryfree": "2.30 GB",
|
57
|
-
"memorysize_mb": "4095.49",
|
58
|
-
"memoryfree_mb": "2360.00",
|
59
|
-
"netmask": "255.255.255.0",
|
60
|
-
"network_ethernet0_2": "192.168.43.0",
|
61
|
-
"operatingsystemmajrelease": "10",
|
62
|
-
"operatingsystemrelease": "10",
|
63
|
-
"osfamily": "windows",
|
64
|
-
"path": "C:\\tools\\ruby24\\bin;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\ProgramData\\chocolatey\\bin;C:\\Program Files (x86)\\vim\\vim80;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Puppet Labs\\Puppet\\bin;C:\\Users\\vagrant\\AppData\\Local\\Microsoft\\WindowsApps;",
|
65
|
-
"physicalprocessorcount": 4,
|
66
|
-
"processors": {
|
67
|
-
"models": [
|
68
|
-
"Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
69
|
-
"Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
70
|
-
"Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
71
|
-
"Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz"
|
72
|
-
],
|
73
|
-
"count": 4,
|
74
|
-
"physicalcount": 4
|
75
|
-
},
|
76
|
-
"processor0": "Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
77
|
-
"processor1": "Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
78
|
-
"processor2": "Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
79
|
-
"processor3": "Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
80
|
-
"processorcount": 4,
|
81
|
-
"ps": "tasklist.exe",
|
82
|
-
"rubyplatform": "x64-mingw32",
|
83
|
-
"rubysitedir": "C:/tools/ruby24/lib/ruby/site_ruby/2.4.0",
|
84
|
-
"rubyversion": "2.4.3",
|
85
|
-
"system32": "C:\\Windows\\system32",
|
86
|
-
"
|
87
|
-
|
88
|
-
"
|
89
|
-
"
|
90
|
-
"
|
91
|
-
|
92
|
-
|
93
|
-
"
|
94
|
-
"
|
95
|
-
"
|
96
|
-
"
|
97
|
-
"
|
98
|
-
"
|
99
|
-
"
|
100
|
-
|
101
|
-
|
102
|
-
"
|
103
|
-
|
1
|
+
{
|
2
|
+
"name": "vagrant-hb9g3rd.lan.asio",
|
3
|
+
"values": {
|
4
|
+
"puppetversion": "6.0.2",
|
5
|
+
"puppet_inventory_metadata": {
|
6
|
+
"packages": {
|
7
|
+
"collection_enabled": false,
|
8
|
+
"last_collection_time": "0.0s"
|
9
|
+
}
|
10
|
+
},
|
11
|
+
"package_provider": "windows",
|
12
|
+
"pe_concat_basedir": "C:/ProgramData/PuppetLabs/puppet/cache/pe_concat",
|
13
|
+
"is_pe": false,
|
14
|
+
"platform_symlink_writable": false,
|
15
|
+
"puppet_files_dir_present": false,
|
16
|
+
"puppet_vardir": "C:/ProgramData/PuppetLabs/puppet/cache",
|
17
|
+
"puppet_environmentpath": "C:/ProgramData/PuppetLabs/code/environments",
|
18
|
+
"puppet_server": "pe-puppet.localdomain",
|
19
|
+
"service_provider": "windows",
|
20
|
+
"staging_http_get": "curl",
|
21
|
+
"common_appdata": "C:\\ProgramData",
|
22
|
+
"architecture": "x64",
|
23
|
+
"kernel": "windows",
|
24
|
+
"virtual": "vmware",
|
25
|
+
"is_virtual": true,
|
26
|
+
"hardwaremodel": "x64",
|
27
|
+
"operatingsystem": "windows",
|
28
|
+
"os": {
|
29
|
+
"name": "windows",
|
30
|
+
"family": "windows",
|
31
|
+
"release": {
|
32
|
+
"major": "10",
|
33
|
+
"full": "10"
|
34
|
+
}
|
35
|
+
},
|
36
|
+
"facterversion": "2.5.1",
|
37
|
+
"fqdn": "VAGRANT-HB9G3RD",
|
38
|
+
"hostname": "VAGRANT-HB9G3RD",
|
39
|
+
"id": "vagrant-hb9g3rd\\vagrant",
|
40
|
+
"interfaces": "Ethernet0_2",
|
41
|
+
"ipaddress_ethernet0_2": "192.168.43.174",
|
42
|
+
"ipaddress6_ethernet0_2": "fd72:b3ab:b8dd:0:f563:fac2:928c:6aa",
|
43
|
+
"macaddress_ethernet0_2": "00:0C:29:A3:53:54",
|
44
|
+
"netmask_ethernet0_2": "255.255.255.0",
|
45
|
+
"mtu_ethernet0_2": 0,
|
46
|
+
"ipaddress": "192.168.43.174",
|
47
|
+
"ipaddress6": "fd72:b3ab:b8dd:0:f563:fac2:928c:6aa",
|
48
|
+
"kernelmajversion": "10.0",
|
49
|
+
"kernelrelease": "10.0.17134",
|
50
|
+
"kernelversion": "10.0.17134",
|
51
|
+
"macaddress": "00:0C:29:A3:53:54",
|
52
|
+
"manufacturer": "Phoenix Technologies LTD",
|
53
|
+
"serialnumber": "VMware-56 4d 36 2e 2e a4 81 f9-0d 05 ae d0 e5 a3 53 54",
|
54
|
+
"productname": "VMware Virtual Platform",
|
55
|
+
"memorysize": "4.00 GB",
|
56
|
+
"memoryfree": "2.30 GB",
|
57
|
+
"memorysize_mb": "4095.49",
|
58
|
+
"memoryfree_mb": "2360.00",
|
59
|
+
"netmask": "255.255.255.0",
|
60
|
+
"network_ethernet0_2": "192.168.43.0",
|
61
|
+
"operatingsystemmajrelease": "10",
|
62
|
+
"operatingsystemrelease": "10",
|
63
|
+
"osfamily": "windows",
|
64
|
+
"path": "C:\\tools\\ruby24\\bin;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\ProgramData\\chocolatey\\bin;C:\\Program Files (x86)\\vim\\vim80;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Puppet Labs\\Puppet\\bin;C:\\Users\\vagrant\\AppData\\Local\\Microsoft\\WindowsApps;",
|
65
|
+
"physicalprocessorcount": 4,
|
66
|
+
"processors": {
|
67
|
+
"models": [
|
68
|
+
"Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
69
|
+
"Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
70
|
+
"Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
71
|
+
"Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz"
|
72
|
+
],
|
73
|
+
"count": 4,
|
74
|
+
"physicalcount": 4
|
75
|
+
},
|
76
|
+
"processor0": "Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
77
|
+
"processor1": "Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
78
|
+
"processor2": "Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
79
|
+
"processor3": "Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz",
|
80
|
+
"processorcount": 4,
|
81
|
+
"ps": "tasklist.exe",
|
82
|
+
"rubyplatform": "x64-mingw32",
|
83
|
+
"rubysitedir": "C:/tools/ruby24/lib/ruby/site_ruby/2.4.0",
|
84
|
+
"rubyversion": "2.4.3",
|
85
|
+
"system32": "C:\\Windows\\system32",
|
86
|
+
"choco_install_path": "C:\\ProgramData\\chocolatey",
|
87
|
+
"system_uptime": {
|
88
|
+
"seconds": 1113359,
|
89
|
+
"hours": 309,
|
90
|
+
"days": 12,
|
91
|
+
"uptime": "12 days"
|
92
|
+
},
|
93
|
+
"timezone": "GMT Standard Time",
|
94
|
+
"uptime": "12 days",
|
95
|
+
"uptime_days": 12,
|
96
|
+
"uptime_hours": 309,
|
97
|
+
"uptime_seconds": 1113359,
|
98
|
+
"clientcert": "vagrant-hb9g3rd.lan.asio",
|
99
|
+
"clientversion": "6.0.2",
|
100
|
+
"clientnoop": false
|
101
|
+
},
|
102
|
+
"timestamp": "2018-12-10T21:43:07.468533000+00:00",
|
103
|
+
"expiration": "2018-12-10T22:13:07.468533000+00:00"
|
104
|
+
}
|
data/features/cache.feature
CHANGED
@@ -14,7 +14,7 @@ Feature: Create and maintain a .onceover cache
|
|
14
14
|
Then the cache should exist
|
15
15
|
And the cache should contain all controlrepo files
|
16
16
|
|
17
|
-
Scenario:
|
17
|
+
Scenario: Run onceover in the caching repo
|
18
18
|
Given control repo "caching"
|
19
19
|
When I run onceover command "run spec --classes role::webserver"
|
20
20
|
Then I should not see any errors
|
@@ -5,12 +5,12 @@ end
|
|
5
5
|
|
6
6
|
Then(/^the cache should contain all controlrepo files/) do
|
7
7
|
# Get all root files
|
8
|
-
|
8
|
+
log("Calculating MD5 hashes in repo")
|
9
9
|
repo_digest = Cache_Helper.digest(@repo.root_folder)
|
10
|
-
|
11
|
-
|
10
|
+
log("#{repo_digest.count} MD5 hashes calculated")
|
11
|
+
log("Calculating MD5 hashes in cache")
|
12
12
|
cache_digest = Cache_Helper.digest(File.join(@repo.root_folder,'.onceover/etc/puppetlabs/code/environments/production/'))
|
13
|
-
|
13
|
+
log("#{cache_digest.count} MD5 hashes calculated")
|
14
14
|
expect(cache_digest).to include(repo_digest)
|
15
15
|
end
|
16
16
|
|
@@ -7,6 +7,8 @@ Given(/^control repo "([^"]*)"$/) do |controlrepo_name|
|
|
7
7
|
@cmd.controlrepo = @repo
|
8
8
|
FileUtils.rm_rf @repo.root_folder
|
9
9
|
FileUtils.mkdir_p @repo.tmp_folder
|
10
|
+
|
11
|
+
FileUtils.rm_rf "#{@repo.tmp_folder}#{controlrepo_name}"
|
10
12
|
FileUtils.cp_r "spec/fixtures/controlrepos/#{controlrepo_name}", @repo.tmp_folder
|
11
13
|
end
|
12
14
|
|
@@ -27,13 +29,13 @@ end
|
|
27
29
|
|
28
30
|
When(/^I run onceover command "([^"]*)"$/) do |command|
|
29
31
|
@cmd.command = "#{command} --debug"
|
30
|
-
|
32
|
+
log(@cmd)
|
31
33
|
@cmd.run
|
32
34
|
end
|
33
35
|
|
34
36
|
When(/^I run onceover command "([^"]*)" with class "([^"]*)"$/) do |command, cls|
|
35
37
|
@cmd.command = "#{command} --classes #{cls}"
|
36
|
-
|
38
|
+
log(@cmd)
|
37
39
|
@cmd.run
|
38
40
|
end
|
39
41
|
|
@@ -53,12 +55,12 @@ Then(/^I see help for commands: "([^"]*)"$/) do |commands|
|
|
53
55
|
commands_help = @cmd.output[/COMMANDS(.*)OPTIONS/m, 1]
|
54
56
|
commands.split(',').each do |command|
|
55
57
|
result = commands_help.match(/^\s+#{command.strip}.+\n/)
|
56
|
-
|
58
|
+
log(result.to_s) if expect(result).not_to be nil
|
57
59
|
end
|
58
60
|
end
|
59
61
|
|
60
62
|
Then(/^I should not see any errors$/) do
|
61
|
-
|
63
|
+
log(@cmd.output) unless @cmd.success?
|
62
64
|
expect(@cmd.success?).to be true
|
63
65
|
end
|
64
66
|
|
@@ -73,17 +75,43 @@ end
|
|
73
75
|
|
74
76
|
Then(/^I should see error with message pattern "([^"]*)"$/) do |err_msg_regexp|
|
75
77
|
expect(@cmd.success?).to be false
|
76
|
-
|
78
|
+
log(@cmd.output)
|
77
79
|
expect(@cmd.output.match err_msg_regexp).to_not be nil
|
78
80
|
end
|
79
81
|
|
80
|
-
Then(/^I should see message pattern "([^"]*)"$/) do |msg_regexp|
|
82
|
+
Then(/^I should (not )?see message pattern "([^"]*)"$/) do |notword, msg_regexp|
|
81
83
|
output_surround = 30
|
82
84
|
match = Regexp.new(msg_regexp).match(@cmd.output)
|
83
|
-
|
84
|
-
|
85
|
-
|
85
|
+
|
86
|
+
# Expect it to match unless we said it shouldn't match
|
87
|
+
expected_match = notword.nil?
|
88
|
+
does_match = !match.nil?
|
89
|
+
|
90
|
+
if expected_match
|
91
|
+
expect(@cmd.output).to match(msg_regexp)
|
92
|
+
else
|
93
|
+
expect(@cmd.output).not_to match(msg_regexp)
|
94
|
+
end
|
95
|
+
|
96
|
+
# If the regex matches and that's what we expected then just print a summary
|
97
|
+
if does_match == expected_match
|
98
|
+
if match
|
99
|
+
log(match.pre_match[-output_surround..-1] + match.to_s + match.post_match[0..output_surround])
|
100
|
+
end
|
86
101
|
else
|
87
|
-
|
102
|
+
log(@cmd.output)
|
88
103
|
end
|
89
104
|
end
|
105
|
+
|
106
|
+
When(/^I run onceover command "([^"]*)" with \-\-puppetfile ([^"]*)$/) do |command, puppetfile|
|
107
|
+
puppetfile_path = @repo.root_folder + puppetfile
|
108
|
+
@cmd.command = "#{command} --puppetfile #{puppetfile_path} --debug"
|
109
|
+
log(@cmd)
|
110
|
+
@cmd.run
|
111
|
+
end
|
112
|
+
|
113
|
+
Then(/^([^"]*) should be copied to Puppetfile$/) do |puppetfile|
|
114
|
+
source = @repo.root_folder + puppetfile
|
115
|
+
destination = @repo.onceover_temp_puppetfile
|
116
|
+
expect(IO.read(source)).to eq(IO.read(destination))
|
117
|
+
end
|
@@ -7,11 +7,11 @@ Then(/^I should see generated all necessary files and folders$/) do
|
|
7
7
|
folders = [ 'spec/factsets', 'spec/pre_conditions'].map! { |x| @repo.root_folder + x}
|
8
8
|
|
9
9
|
files.each do |file|
|
10
|
-
|
10
|
+
log(file)
|
11
11
|
expect( File.exist? file ).to be true
|
12
12
|
end
|
13
13
|
folders.each do |folder|
|
14
|
-
|
14
|
+
log(folder)
|
15
15
|
expect( Dir.exist? folder ).to be true
|
16
16
|
end
|
17
17
|
end
|
data/features/windows.feature
CHANGED
@@ -28,3 +28,8 @@ Feature: Run onceover with windows
|
|
28
28
|
When I run onceover command "run spec" with class "role::users"
|
29
29
|
Then I should not see any errors
|
30
30
|
|
31
|
+
Scenario: Compiling a windows role with chocolatey that is valid should compile
|
32
|
+
Given control repo "windows"
|
33
|
+
When I run onceover command "run spec" with class "role::choco"
|
34
|
+
Then I should not see any errors
|
35
|
+
|
data/features/zzz_run.feature
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
@run
|
2
2
|
Feature: Run rspec and acceptance test suites
|
3
|
-
Onceover should allow to run rspec and acceptance test for all
|
3
|
+
Onceover should allow to run rspec and acceptance test for all profile and role classes
|
4
4
|
or for any part of them. Use should set if he wants to see only summary of tests or full
|
5
5
|
log info.
|
6
6
|
|
@@ -52,6 +52,11 @@ Feature: Run rspec and acceptance test suites
|
|
52
52
|
And I run onceover command "run spec --force"
|
53
53
|
Then I should see message pattern "Overwriting local modifications"
|
54
54
|
|
55
|
+
Scenario: When using an alternate manifests directory
|
56
|
+
Given initialized control repo "basic"
|
57
|
+
When I run onceover command "run spec --manifest manifests_alternate"
|
58
|
+
Then I should see error with message pattern "Using alternate site.pp"
|
59
|
+
|
55
60
|
Scenario: Check that control_branch functionality works
|
56
61
|
Given initialized control repo "control_branch"
|
57
62
|
When I run onceover command "run spec"
|
@@ -73,8 +78,22 @@ Feature: Run rspec and acceptance test suites
|
|
73
78
|
Then I should see message pattern "failed"
|
74
79
|
And Onceover should exit 1
|
75
80
|
|
81
|
+
Scenario: Run with a custom Puppetfile
|
82
|
+
Given initialized control repo "custom_puppetfile"
|
83
|
+
When I run onceover command "run spec" with --puppetfile Puppetfile.custom
|
84
|
+
Then Puppetfile.custom should be copied to Puppetfile
|
85
|
+
And I should see message pattern "Using Puppetfile .*Puppetfile"
|
86
|
+
And I should see message pattern "Updating module .*extlib"
|
87
|
+
|
88
|
+
Scenario: Testing that --tags works with native rspec tags
|
89
|
+
Given control repo "puppet_controlrepo"
|
90
|
+
When I run onceover command "run spec --tags syntax"
|
91
|
+
Then I should not see any errors
|
92
|
+
And I should see message pattern "When checking Puppet syntax"
|
93
|
+
And I should not see message pattern "role::"
|
94
|
+
|
76
95
|
# This test is a full test using my controlrepo. It should remain at the end because it takes ages
|
77
96
|
Scenario: Run advanced spec tests
|
78
97
|
Given control repo "puppet_controlrepo"
|
79
|
-
When I run onceover command "run spec -p"
|
80
|
-
Then I should not see any errors
|
98
|
+
When I run onceover command "run spec -p --force"
|
99
|
+
Then I should not see any errors
|
data/lib/onceover/controlrepo.rb
CHANGED
@@ -123,10 +123,16 @@ class Onceover
|
|
123
123
|
@profile_regex = opts[:profile_regex] ? Regexp.new(opts[:profile_regex]) : /profile[s]?:{2}/
|
124
124
|
@tempdir = opts[:tempdir] || File.expand_path('./.onceover', @root)
|
125
125
|
$temp_modulepath = nil
|
126
|
-
@manifest = opts[:manifest] || config['manifest'] ? File.expand_path(config['manifest'], @root) : nil
|
127
126
|
@opts = opts
|
128
127
|
logger.level = :debug if @opts[:debug]
|
129
128
|
@@existing_controlrepo = self
|
129
|
+
|
130
|
+
# Set the manifest option to the fully expanded path if it's used,
|
131
|
+
# default to nil
|
132
|
+
manifest = opts[:manifest] || config['manifest'] || nil
|
133
|
+
if manifest
|
134
|
+
@manifest = File.expand_path(manifest, @root)
|
135
|
+
end
|
130
136
|
end
|
131
137
|
|
132
138
|
|
@@ -420,7 +426,7 @@ class Onceover
|
|
420
426
|
rescue StandardError
|
421
427
|
raise "modulepath was not found in environment.conf, don't know where to look for roles & profiles"
|
422
428
|
end
|
423
|
-
|
429
|
+
|
424
430
|
environment_config
|
425
431
|
end
|
426
432
|
|
@@ -444,7 +450,7 @@ class Onceover
|
|
444
450
|
end
|
445
451
|
|
446
452
|
def temp_manifest
|
447
|
-
|
453
|
+
@manifest
|
448
454
|
end
|
449
455
|
|
450
456
|
def self.init(repo)
|
@@ -642,7 +648,7 @@ class Onceover
|
|
642
648
|
def find_classname(filename)
|
643
649
|
file = File.new(filename, "r")
|
644
650
|
while (line = file.gets)
|
645
|
-
begin
|
651
|
+
begin
|
646
652
|
if line =~ /^class (\w+(?:::\w+)*)/
|
647
653
|
return $1
|
648
654
|
end
|
data/lib/onceover/deploy.rb
CHANGED
@@ -83,6 +83,7 @@ class Onceover
|
|
83
83
|
logger.debug "found #{git_branch} as current working branch"
|
84
84
|
# Only try to modify Puppetfile if it exists
|
85
85
|
unless skip_r10k
|
86
|
+
FileUtils.copy repo.puppetfile, "#{temp_controlrepo}/Puppetfile"
|
86
87
|
puppetfile_contents = File.read("#{temp_controlrepo}/Puppetfile")
|
87
88
|
|
88
89
|
logger.debug "replacing :control_branch mentions in the Puppetfile with #{git_branch}"
|
@@ -118,10 +119,11 @@ class Onceover
|
|
118
119
|
prod_dir = "#{repo.tempdir}/#{repo.environmentpath}/production"
|
119
120
|
Dir.chdir(prod_dir) do
|
120
121
|
install_cmd = []
|
121
|
-
install_cmd <<
|
122
|
+
install_cmd << 'r10k puppetfile install --color'
|
122
123
|
install_cmd << "--force" if force
|
123
124
|
install_cmd << "--config #{repo.r10k_config_file}" if repo.r10k_config_file
|
124
125
|
install_cmd << (logger.level > 0 ? "--verbose" : "--verbose debug") # Enable debugging if we're debugging
|
126
|
+
install_cmd << "--trace" if opts[:trace]
|
125
127
|
install_cmd = install_cmd.join(' ')
|
126
128
|
logger.debug "Running #{install_cmd} from #{prod_dir}"
|
127
129
|
system(install_cmd)
|