octofacts-updater 0.5.1 → 0.6.0

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: b4b50c8a2fec8f9a4246634633180bf12276c66e
4
- data.tar.gz: 41484ac0bc84813a554ff68c7e92ebee525756e3
2
+ SHA256:
3
+ metadata.gz: 378e8881afb698fafb804327ef23d85614d8b2d556c7c4945d82fe4f7fbc6cb2
4
+ data.tar.gz: 9c45ac588e4115cde24c2bb2a9d4028f514cec0bd0caf1c59673f0dad53f9662
5
5
  SHA512:
6
- metadata.gz: cbd45aa3e9cb4d6e7e79e25dc85339887c3a6044d958ddc4e20fb8664310909c2be3d37e6a8315e15b80076779747d1f66a840d34178b23347839a2ee76ef345
7
- data.tar.gz: f74a33d55190ff784ced6238717266ed6ff94c07a8f4e4bfa09e5c159f389b95ec56a2c28b4e6040c84eddb25c2914c4d0a99e893dcd330d4455b6df840ad704
6
+ metadata.gz: 3c64cad8078c0e1efd1198dbb556de9733c89f954afc287925365f65b0913f446c5ff823e435e0af347561913cb72a09f68102f9a794c07a646e3997a1e0ea06
7
+ data.tar.gz: ba83a060abd2fc746d99a1214b7f5e0bb285b4e5c2bfb4e93150a584c84ccdc67bfac163dd7c8a76bc84edcca1e98872551e25489695d2e8d878b842b7b11a3f
data/.version CHANGED
@@ -1 +1 @@
1
- 0.5.1
1
+ 0.6.0
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
-
2
+ # frozen_string_literal: true
3
+ #
3
4
  require "bundler/setup"
4
5
  require "octofacts_updater"
5
6
  cli = OctofactsUpdater::CLI.new(ARGV)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # :nocov:
2
3
  require "optparse"
3
4
 
@@ -133,12 +134,12 @@ module OctofactsUpdater
133
134
  @opts[:quick] = true
134
135
 
135
136
  path = if opts[:path]
136
- File.expand_path(opts[:path])
137
- elsif @config.fetch("index", {})["node_path"]
138
- File.expand_path(@config.fetch("index", {})["node_path"], File.dirname(opts[:config]))
139
- else
140
- raise ArgumentError, "Must set --path, or define index:node_path to a valid directory in configuration"
141
- end
137
+ File.expand_path(opts[:path])
138
+ elsif @config.fetch("index", {})["node_path"]
139
+ File.expand_path(@config.fetch("index", {})["node_path"], File.dirname(opts[:config]))
140
+ else
141
+ raise ArgumentError, "Must set --path, or define index:node_path to a valid directory in configuration"
142
+ end
142
143
 
143
144
  unless File.directory?(path)
144
145
  raise Errno::ENOENT, "--path must be a directory (#{path.inspect} is not)"
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # This class represents a fact, either structured or unstructured.
2
3
  # The fact has a name and a value. The name is a string, and the value
3
4
  # can either be a string/integer/boolean (unstructured) or a hash (structured).
@@ -65,20 +66,20 @@ module OctofactsUpdater
65
66
  end
66
67
 
67
68
  parts = if name_in.is_a?(String)
68
- name_in.split("::")
69
- elsif name_in.is_a?(Array)
70
- name_in.map do |item|
71
- if item.is_a?(String)
72
- item
73
- elsif item.is_a?(Hash) && item.key?("regexp")
74
- Regexp.new(item["regexp"])
75
- else
76
- raise ArgumentError, "Unable to interpret structure item: #{item.inspect}"
77
- end
78
- end
79
- else
80
- raise ArgumentError, "Unable to interpret structure: #{name_in.inspect}"
81
- end
69
+ name_in.split("::")
70
+ elsif name_in.is_a?(Array)
71
+ name_in.map do |item|
72
+ if item.is_a?(String)
73
+ item
74
+ elsif item.is_a?(Hash) && item.key?("regexp")
75
+ Regexp.new(item["regexp"])
76
+ else
77
+ raise ArgumentError, "Unable to interpret structure item: #{item.inspect}"
78
+ end
79
+ end
80
+ else
81
+ raise ArgumentError, "Unable to interpret structure: #{name_in.inspect}"
82
+ end
82
83
 
83
84
  set_structured_value(@value, parts, new_value)
84
85
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # This class represents a fact index, which is ultimately represented by a YAML file of
2
3
  # each index fact, the values seen, and the node(s) containing each value.
3
4
  #
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # This class represents a fact fixture, which is a set of facts along with a node name.
2
3
  # Facts are OctofactsUpdater::Fact objects, and internally are stored as a hash table
3
4
  # with the key being the fact name and the value being the OctofactsUpdater::Fact object.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # This class provides the base methods for fact manipulation plugins.
2
3
 
3
4
  require "digest"
@@ -61,7 +62,8 @@ module OctofactsUpdater
61
62
  #
62
63
  # Returns a String with the same length as string_in.
63
64
  def self.randomize_long_string(string_in)
64
- seed = Digest::MD5.hexdigest(string_in).to_i(36)
65
+ seed = Digest::SHA512.hexdigest(string_in).to_i(36)
66
+
65
67
  prng = Random.new(seed)
66
68
  chars = [("a".."z"), ("A".."Z"), ("0".."9")].flat_map(&:to_a)
67
69
  (1..(string_in.length)).map { chars[prng.rand(chars.length)] }.join
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # This file is part of the octofacts updater fact manipulation plugins. This plugin provides
2
3
  # methods to update facts that are IP addresses in order to anonymize or randomize them.
3
4
 
@@ -1,4 +1,5 @@
1
1
  # This file is part of the octofacts updater fact manipulation plugins. This plugin provides
2
+ # frozen_string_literal: true
2
3
  # methods to update facts that are SSH keys, since we do not desire to commit SSH keys from
3
4
  # actual hosts into the source code repository.
4
5
 
@@ -1,4 +1,5 @@
1
1
  # This file is part of the octofacts updater fact manipulation plugins. This plugin provides
2
+ # frozen_string_literal: true
2
3
  # methods to do static operations on facts -- delete, add, or set to a known value.
3
4
 
4
5
  # Delete. This method deletes the fact or the identified portion. Setting the value to nil
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # This contains handy utility methods that might be used in any of the other classes.
2
3
 
3
4
  require "yaml"
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # This class contains methods to interact with an external node classifier.
2
3
 
3
4
  require "open3"
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # This class reads a YAML file from the local file system so that it can be used as a source
2
3
  # in octofacts-updater. This was originally intended for a quickstart tutorial, since it requires
3
4
  # no real configuration. However it could also be used in production, if the user wants to create
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # This class interacts with puppetdb to pull the facts from the recent
2
3
  # run of Puppet on a given node. This uses octocatalog-diff on the back end to
3
4
  # pull the facts from puppetdb.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # This class interacts with a puppetserver to obtain facts from that server's YAML cache.
2
3
  # This is achieved by SSH-ing to the server and obtaining the fact file directly from the
3
4
  # puppetserver's cache. This can also be used to SSH to an actual node and run a command,
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module OctofactsUpdater
2
3
  VERSION = File.read(File.expand_path("../../.version", File.dirname(__FILE__))).strip
3
4
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require "octofacts_updater/cli"
2
3
  require "octofacts_updater/fact"
3
4
  require "octofacts_updater/fact_index"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octofacts-updater
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub, Inc.
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-10-09 00:00:00.000000000 Z
13
+ date: 2024-08-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: diffy
@@ -32,14 +32,14 @@ dependencies:
32
32
  requirements:
33
33
  - - ">="
34
34
  - !ruby/object:Gem::Version
35
- version: 1.4.1
35
+ version: 2.1.0
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 1.4.1
42
+ version: 2.1.0
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: octokit
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -68,8 +68,10 @@ dependencies:
68
68
  - - ">="
69
69
  - !ruby/object:Gem::Version
70
70
  version: '2.9'
71
- description: |
72
- Octofacts-updater is a series of scripts to construct the fact fixture files and index files consumed by octofacts.
71
+ description: 'Octofacts-updater is a series of scripts to construct the fact fixture
72
+ files and index files consumed by octofacts.
73
+
74
+ '
73
75
  email: opensource+octofacts@github.com
74
76
  executables:
75
77
  - octofacts-updater
@@ -106,15 +108,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
106
108
  requirements:
107
109
  - - ">="
108
110
  - !ruby/object:Gem::Version
109
- version: 2.1.0
111
+ version: 2.7.0
110
112
  required_rubygems_version: !ruby/object:Gem::Requirement
111
113
  requirements:
112
114
  - - ">="
113
115
  - !ruby/object:Gem::Version
114
116
  version: '0'
115
117
  requirements: []
116
- rubyforge_project:
117
- rubygems_version: 2.2.5
118
+ rubygems_version: 3.4.19
118
119
  signing_key:
119
120
  specification_version: 4
120
121
  summary: Scripts to update octofacts fixtures from recent Puppet runs