Skip to content

Commit 964d92b

Browse files
author
Kevin Paulisse
committed
Remove featureless fact override class and add ENC override call
1 parent 3e00f4e commit 964d92b

4 files changed

Lines changed: 16 additions & 287 deletions

File tree

lib/octocatalog-diff/cli.rb

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
require_relative 'api/v1'
44
require_relative 'catalog-util/cached_master_directory'
55
require_relative 'cli/diffs'
6-
require_relative 'cli/fact_override'
76
require_relative 'cli/options'
87
require_relative 'cli/printer'
98
require_relative 'errors'
@@ -82,8 +81,9 @@ def self.cli(argv = ARGV, logger = Logger.new(STDERR), opts = {})
8281
veto_with_none_options = %w(hiera_path hiera_path_strip)
8382
veto_with_none_options.each { |x| options.delete(x.to_sym) if options[x.to_sym] == :none }
8483

85-
# Fact overrides come in here - 'options' is modified
84+
# Fact and ENC overrides come in here - 'options' is modified
8685
setup_fact_overrides(options)
86+
setup_enc_overrides(options)
8787

8888
# Configure the logger and logger.debug initial information
8989
# 'logger' is modified and used
@@ -136,7 +136,18 @@ def self.setup_fact_overrides(options)
136136
next unless o.is_a?(Array)
137137
next unless o.any?
138138
options[key] ||= []
139-
options[key].concat o.map { |x| OctocatalogDiff::Cli::FactOverride.fact_override(x) }
139+
options[key].concat o.map { |x| OctocatalogDiff::API::V1::Override.create_from_input(x) }
140+
end
141+
end
142+
143+
# ENC parameter overrides come in here
144+
def self.setup_enc_overrides(options)
145+
[:from_enc_override, :to_enc_override].each do |key|
146+
o = options["#{key}_in".to_sym]
147+
next unless o.is_a?(Array)
148+
next unless o.any?
149+
options[key] ||= []
150+
options[key].concat o.map { |x| OctocatalogDiff::API::V1::Override.create_from_input(x) }
140151
end
141152
end
142153

lib/octocatalog-diff/cli/fact_override.rb

Lines changed: 0 additions & 20 deletions
This file was deleted.

spec/octocatalog-diff/tests/catalog-util/builddir_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# frozen_string_literal: true
22

33
require_relative '../spec_helper'
4+
require OctocatalogDiff::Spec.require_path('/api/v1')
45
require OctocatalogDiff::Spec.require_path('/facts')
56
require OctocatalogDiff::Spec.require_path('/catalog-util/builddir')
6-
require OctocatalogDiff::Spec.require_path('/cli/fact_override')
77
require 'socket'
88
require 'yaml'
99

@@ -531,7 +531,7 @@
531531
context 'with fact overrides' do
532532
it 'should create and populate the fact file' do
533533
overrides_raw = %w(ipaddress=10.30.50.70 fizz=buzz jsontest=(json){"foo":"bar"})
534-
overrides = overrides_raw.map { |x| OctocatalogDiff::Cli::FactOverride.fact_override(x) }
534+
overrides = overrides_raw.map { |x| OctocatalogDiff::API::V1::Override.create_from_input(x) }
535535
options = {
536536
basedir: OctocatalogDiff::Spec.fixture_path('repos/default'),
537537
fact_file: OctocatalogDiff::Spec.fixture_path('facts/valid-facts.yaml'),

spec/octocatalog-diff/tests/cli/fact_override_spec.rb

Lines changed: 0 additions & 262 deletions
This file was deleted.

0 commit comments

Comments
 (0)