File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ def initialize(options = {})
3131 @error_message = nil
3232 @catalog = nil
3333 @catalog_json = nil
34+ @retries = nil
3435
3536 # The compilation directory can be overridden, e.g. when testing
3637 @override_compilation_dir = options [ :compilation_dir ]
Original file line number Diff line number Diff line change @@ -39,7 +39,6 @@ def initialize(options)
3939 @puppet_binary = options [ :puppet_binary ]
4040 @puppet_version = options [ :puppet_version ]
4141 @puppet_command = options [ :puppet_command ]
42- @retries = nil
4342 @builddir = nil
4443 @facts_terminus = options . fetch ( :facts_terminus , 'yaml' )
4544 end
Original file line number Diff line number Diff line change @@ -14,7 +14,10 @@ class JSON < OctocatalogDiff::Catalog
1414 # @param :node [String] Node name (if not supplied, will be determined from catalog)
1515 def initialize ( options )
1616 super
17- raise ArgumentError , "Must supply :json as string in options: #{ options [ :json ] . class } " unless options [ :json ] . is_a? ( String )
17+
18+ unless options [ :json ] . is_a? ( String )
19+ raise ArgumentError , "Must supply :json as string in options: #{ options [ :json ] . class } "
20+ end
1821
1922 @catalog_json = options . fetch ( :json )
2023 begin
Original file line number Diff line number Diff line change @@ -17,14 +17,9 @@ class PuppetDB < OctocatalogDiff::Catalog
1717 def initialize ( options )
1818 super
1919
20- raise ArgumentError , 'node must be a non-empty string' unless options [ :node ] . is_a? ( String ) && options [ :node ] != ''
21- @node = options [ :node ]
22- @catalog = nil
23- @error_message = nil
24- @retries = nil
25-
26- # Save options
27- @options = options
20+ unless @options [ :node ] . is_a? ( String ) && @options [ :node ] != ''
21+ raise ArgumentError , 'node must be a non-empty string'
22+ end
2823 end
2924
3025 private
Original file line number Diff line number Diff line change @@ -34,20 +34,21 @@ class PuppetMaster < OctocatalogDiff::Catalog
3434 def initialize ( options )
3535 super
3636
37- raise ArgumentError , 'node must be a non-empty string' unless options [ :node ] . is_a? ( String ) && options [ :node ] != ''
38- unless options [ :branch ] . is_a? ( String ) && options [ :branch ] != ''
37+ unless @options [ :node ] . is_a? ( String ) && @options [ :node ] != ''
38+ raise ArgumentError , 'node must be a non-empty string'
39+ end
40+
41+ unless @options [ :branch ] . is_a? ( String ) && @options [ :branch ] != ''
3942 raise ArgumentError , 'Environment must be a non-empty string'
4043 end
41- unless options [ :puppet_master ] . is_a? ( String ) && options [ :puppet_master ] != ''
44+
45+ unless @options [ :puppet_master ] . is_a? ( String ) && @options [ :puppet_master ] != ''
4246 raise ArgumentError , 'Puppet Master must be a non-empty string'
4347 end
4448
45- @retries = nil
4649 @timeout = options . fetch ( :puppet_master_timeout , options . fetch ( :timeout , PUPPET_MASTER_TIMEOUT ) )
4750 @retry_failed_catalog = options . fetch ( :retry_failed_catalog , 0 )
48-
49- options [ :puppet_master ] += ":#{ DEFAULT_PUPPET_PORT_NUMBER } " unless options [ :puppet_master ] =~ /\: \d +$/
50- @options = options
51+ @options [ :puppet_master ] += ":#{ DEFAULT_PUPPET_PORT_NUMBER } " unless @options [ :puppet_master ] =~ /\: \d +$/
5152 end
5253
5354 private
You can’t perform that action at this time.
0 commit comments