Skip to content

Commit 21f34ca

Browse files
committed
finish fixes and improvements to octo-diff absent
1 parent 30a0a1d commit 21f34ca

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
### 2.3.1 (Next)
22
- No input target paths now defaults to current working directory instead of error.
33
- Additionally check `Vagrantfile` and `gemspec` files.
4+
- Fix behavior for when optional dependency `octocatalog-diff` is absent.
45

56
### 2.3.0
67
- Minimum Ruby version increased to 2.7.

lib/puppet-check/regression_check.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ def self.config(octoconfig)
2929
end
3030
end
3131
rescue LoadError
32-
# octocatalog-diff not installed
32+
warn 'puppet-check: octocatalog-diff is not installed, and therefore the regression checks will be skipped'
3333
end

lib/puppet_check.rb

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,12 @@ def run(settings = {}, paths = [])
3636
if parsed_files[:errors].empty? && (!settings[:fail_on_warning] || parsed_files[:warnings].empty?)
3737
begin
3838
require_relative 'puppet-check/regression_check'
39-
# if octocatalog-diff is not installed then return immediately
40-
rescue LoadError
41-
warn 'octocatalog-diff is not installed, and therefore the regressions check will be skipped'
42-
return 0
43-
end
4439

45-
# perform smoke checks if there were no errors and the user desires
46-
begin
40+
# perform smoke checks if there were no errors and the user desires
4741
catalog = RegressionCheck.smoke(settings[:octonodes], settings[:octoconfig]) if settings[:smoke]
42+
# if octocatalog-diff is not installed then continue immediately
43+
rescue NameError
44+
puts 'puppet-check: immediately continuing to results'
4845
# smoke check failure? output message and return 2
4946
rescue OctocatalogDiff::Errors::CatalogError => err
5047
puts 'There was a smoke check error:'
@@ -61,6 +58,7 @@ def run(settings = {}, paths = [])
6158
# puts catalog.error_message unless catalog.valid?
6259
# 2
6360
# end
61+
6462
# code to output differences in catalog?
6563
# everything passed? return 0
6664
0

spec/puppet-check/regression_check_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@
3737
end
3838
end
3939
rescue NameError
40-
puts 'octocatalog-diff is not installed, and its unit tests will be skipped'
40+
puts 'puppet-check+rspec: octocatalog-diff is not installed, and its unit tests will be skipped'
4141
end

0 commit comments

Comments
 (0)