onceover-octocatalog-diff 0.1.3 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 68aa04b2c0ceb4c15ca00ab21af57ec27f2924ca
4
- data.tar.gz: 1a8d7817d910b3b9426f97a9ca9132448fd8a422
2
+ SHA256:
3
+ metadata.gz: f6b8efb6be914b821f8901c3d6f419de0b1b270bfcda5aa4eab7cc69bcff6916
4
+ data.tar.gz: b4c07fb7929daaf8d5b3312e137a1c94706b5d1a5c49ec0fa70248fd631b0406
5
5
  SHA512:
6
- metadata.gz: bd7c80e73b8a074c8610cb126917f313bb9a5412820fa33827c515b07cb9892af3ef52e8c74fff1ce5cd6dff29d11023094dc5a00476df357ff5e12d7b6f82c4
7
- data.tar.gz: a061f8dd56be4548ceb2093846c68461c48e004a8a8a45b2b9831bf9495343df5eccde2590e1420ff4889b5af0f985cde793deff3b96dbc15ac36d430bfbc2fb
6
+ metadata.gz: db3dd83d2afab6235ace362f5a3668ef94725dcdef002d57cf89c81d4564822e206f9faecc49960d8b065f7222b59c23510c4b96b76907ec6804ac8cc739af4f
7
+ data.tar.gz: 2a74afa2dd587f8ee2d56f3c25eab847b0664a270036060b5b1e2e2d00cc35859309a280509a47178ff66349cc36786ff4652c2bbd7fc65d4acdf06795481758
@@ -4,14 +4,7 @@ require "onceover/octocatalog/diff/cli"
4
4
  class Onceover
5
5
  module Octocatalog
6
6
  module Diff
7
- def self.create_facts_yaml(repo,output_location)
8
- require 'json'
9
-
10
- repo.facts_files.each do |facts_file|
11
- facts = JSON.load(File.read(facts_file))
12
- File.open("#{output_location}/#{File.basename(facts_file,'.*')}.yaml", 'w') {|f| f.write facts.to_yaml }
13
- end
14
- end
7
+
15
8
  end
16
9
  end
17
10
  end
@@ -49,14 +49,24 @@ revisions to compare between.
49
49
  logger.debug "Copying controlrepo to #{tempdir}"
50
50
  FileUtils.copy_entry(repo.root,tempdir)
51
51
 
52
+ # Copy all of the factsets over in reverse order so that
53
+ # local ones override vendored ones
54
+ logger.debug "Deploying vendored factsets"
55
+ deduped_factsets = repo.facts_files.reverse.inject({}) do |hash, file|
56
+ hash[File.basename(file)] = file
57
+ hash
58
+ end
59
+
60
+ deduped_factsets.each do |basename,path|
61
+ facts = JSON.load(File.read(path))
62
+ File.open("#{tempdir}/spec/factsets/#{File.basename(path,'.*')}.yaml", 'w') { |f| f.write facts.to_yaml }
63
+ end
64
+
52
65
  if File.directory?("#{r10k_cache_dir}/modules")
53
66
  logger.debug "Copying modules from thread cache to #{tempdir}"
54
67
  FileUtils.copy_entry("#{r10k_cache_dir}/modules","#{tempdir}/modules")
55
68
  end
56
69
 
57
- logger.debug "Converting facts to yaml"
58
- Onceover::Octocatalog::Diff.create_facts_yaml(repo,"#{tempdir}/spec/factsets")
59
-
60
70
  logger.info "Deploying Puppetfile for #{test.classes[0].name} on #{test.nodes[0].name}"
61
71
  r10k_cmd = "r10k puppetfile install --verbose --color --puppetfile #{repo.puppetfile} --config #{r10k_cache_dir}/r10k.yaml"
62
72
  Open3.popen3(r10k_cmd, :chdir => tempdir) do |stdin, stdout, stderr, wait_thr|
@@ -80,9 +90,31 @@ revisions to compare between.
80
90
  binary = `which puppet`.chomp
81
91
 
82
92
  logger.debug "Running Octocatalog diff"
83
- logger.debug "Command: octocatalog-diff --fact-file #{tempdir}/spec/factsets/#{test.nodes[0].name}.yaml -f #{opts[:from]} -t #{opts[:to]} --basedir #{tempdir} --puppet-binary #{binary} --bootstrap-script #{tempdir}/bootstrap_script.rb"
84
93
  logger.info "Compiling catalogs for #{test.classes[0].name} on #{test.nodes[0].name}"
85
- cmd = "octocatalog-diff --fact-file #{tempdir}/spec/factsets/#{test.nodes[0].name}.yaml -f #{opts[:from]} -t #{opts[:to]} --basedir #{tempdir} --puppet-binary #{binary} --bootstrap-script '#{tempdir}/bootstrap_script.rb'"
94
+
95
+ command_prefix = ENV['BUNDLE_GEMFILE'] ? 'bundle exec ' : ''
96
+
97
+ command_args = [
98
+ '--fact-file',
99
+ "#{tempdir}/spec/factsets/#{test.nodes[0].name}.yaml",
100
+ '--from',
101
+ opts[:from],
102
+ '--to',
103
+ opts[:to],
104
+ '--basedir',
105
+ tempdir,
106
+ '--puppet-binary',
107
+ binary,
108
+ '--bootstrap-script',
109
+ "'#{tempdir}/bootstrap_script.rb'",
110
+ '--hiera-config',
111
+ repo.hiera_config_file,
112
+ '--pass-env-vars',
113
+ ENV.keys.keep_if {|k| k =~ /^RUBY|^BUNDLE/ }.join(',')
114
+ ]
115
+
116
+ cmd = "#{command_prefix}octocatalog-diff #{command_args.join(' ')}"
117
+ logger.debug "Running: #{cmd}"
86
118
  Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr|
87
119
  exit_status = wait_thr.value
88
120
  @results << {
@@ -1,7 +1,7 @@
1
1
  class Onceover
2
2
  module Octocatalog
3
3
  module Diff
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.8"
5
5
  end
6
6
  end
7
7
  end
@@ -21,8 +21,8 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ["lib"]
23
23
 
24
- spec.add_development_dependency "bundler", "~> 1.13"
25
- spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "bundler", ">= 2.2.10"
25
+ spec.add_development_dependency "rake", ">= 12.3.3"
26
26
  spec.add_runtime_dependency 'octocatalog-diff', '~> 1.0'
27
27
  spec.add_runtime_dependency 'onceover', '>= 3.2.0'
28
28
  end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onceover-octocatalog-diff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dylan Ratcliffe
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-13 00:00:00.000000000 Z
11
+ date: 2021-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.13'
19
+ version: 2.2.10
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.13'
26
+ version: 2.2.10
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: 12.3.3
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: 12.3.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: octocatalog-diff
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -90,7 +90,7 @@ homepage: https://github.com/dylanratcliffe/onceover-octocatalog-diff
90
90
  licenses:
91
91
  - MIT
92
92
  metadata: {}
93
- post_install_message:
93
+ post_install_message:
94
94
  rdoc_options: []
95
95
  require_paths:
96
96
  - lib
@@ -105,9 +105,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  - !ruby/object:Gem::Version
106
106
  version: '0'
107
107
  requirements: []
108
- rubyforge_project:
109
- rubygems_version: 2.5.2
110
- signing_key:
108
+ rubyforge_project:
109
+ rubygems_version: 2.7.6.2
110
+ signing_key:
111
111
  specification_version: 4
112
112
  summary: Adds octocatalog-diff functionality to onceover
113
113
  test_files: []