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 +5 -5
- data/.version +1 -1
- data/bin/octofacts-updater +2 -1
- data/lib/octofacts_updater/cli.rb +7 -6
- data/lib/octofacts_updater/fact.rb +15 -14
- data/lib/octofacts_updater/fact_index.rb +1 -0
- data/lib/octofacts_updater/fixture.rb +1 -0
- data/lib/octofacts_updater/plugin.rb +3 -1
- data/lib/octofacts_updater/plugins/ip.rb +1 -0
- data/lib/octofacts_updater/plugins/ssh.rb +1 -0
- data/lib/octofacts_updater/plugins/static.rb +1 -0
- data/lib/octofacts_updater/service/base.rb +1 -0
- data/lib/octofacts_updater/service/enc.rb +1 -0
- data/lib/octofacts_updater/service/local_file.rb +1 -0
- data/lib/octofacts_updater/service/puppetdb.rb +1 -0
- data/lib/octofacts_updater/service/ssh.rb +1 -0
- data/lib/octofacts_updater/version.rb +1 -0
- data/lib/octofacts_updater.rb +1 -0
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 378e8881afb698fafb804327ef23d85614d8b2d556c7c4945d82fe4f7fbc6cb2
|
4
|
+
data.tar.gz: 9c45ac588e4115cde24c2bb2a9d4028f514cec0bd0caf1c59673f0dad53f9662
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c64cad8078c0e1efd1198dbb556de9733c89f954afc287925365f65b0913f446c5ff823e435e0af347561913cb72a09f68102f9a794c07a646e3997a1e0ea06
|
7
|
+
data.tar.gz: ba83a060abd2fc746d99a1214b7f5e0bb285b4e5c2bfb4e93150a584c84ccdc67bfac163dd7c8a76bc84edcca1e98872551e25489695d2e8d878b842b7b11a3f
|
data/.version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.6.0
|
data/bin/octofacts-updater
CHANGED
@@ -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
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
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
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
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 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::
|
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,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 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 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,
|
data/lib/octofacts_updater.rb
CHANGED
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.
|
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:
|
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.
|
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.
|
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
|
-
|
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.
|
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
|
-
|
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
|