@@ -123,17 +123,12 @@ def self.cli(argv = ARGV, logger = Logger.new(STDERR), opts = {})
123
123
all_diffs = [ ]
124
124
125
125
# run multiple node diffs in parallel
126
- Parallel . map ( node_set , in_threads : 4 ) do |node |
127
- options [ :node ] = node
128
- catalog_diff = OctocatalogDiff ::API ::V1 . catalog_diff ( options . merge ( logger : logger ) )
129
- diffs = catalog_diff . diffs
130
-
131
- # Display diffs
132
- printer_obj = OctocatalogDiff ::Cli ::Printer . new ( options , logger )
133
- printer_obj . printer ( diffs , catalog_diff . from . compilation_dir , catalog_diff . to . compilation_dir )
134
-
135
- # Append any diffs for final exit status
136
- all_diffs << diffs
126
+ if node_set . size == 1
127
+ all_diffs << run_octocatalog_diff ( node_set . first , options , logger )
128
+ else
129
+ ::Parallel . map ( node_set , in_threads : 4 ) do |node |
130
+ all_diffs << run_octocatalog_diff ( node , options , logger )
131
+ end
137
132
end
138
133
139
134
# Return the resulting diff object if requested (generally for testing) or otherwise return exit code
@@ -147,6 +142,24 @@ def self.cli(argv = ARGV, logger = Logger.new(STDERR), opts = {})
147
142
EXITCODE_SUCCESS_NO_DIFFS
148
143
end
149
144
145
+ # Run the octocatalog-diff process for a given node. Return the diffs for a contribution to
146
+ # the final exit status.
147
+ # node - String with the node
148
+ # options - All of the currently defined options
149
+ # logger - Logger object
150
+ def self . run_octocatalog_diff ( node , options , logger )
151
+ options_copy = options . merge ( node : node )
152
+ catalog_diff = OctocatalogDiff ::API ::V1 . catalog_diff ( options_copy . merge ( logger : logger ) )
153
+ diffs = catalog_diff . diffs
154
+
155
+ # Display diffs
156
+ printer_obj = OctocatalogDiff ::Cli ::Printer . new ( options_copy , logger )
157
+ printer_obj . printer ( diffs , catalog_diff . from . compilation_dir , catalog_diff . to . compilation_dir )
158
+
159
+ # Return diffs
160
+ diffs
161
+ end
162
+
150
163
# Parse command line options with 'optparse'. Returns a hash with the parsed arguments.
151
164
# @param argv [Array] Command line arguments (MUST be specified)
152
165
# @return [Hash] Options
0 commit comments