dropsonde 0.0.8 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 05a4a694cd3915ec7c3683c7c8250fd1f857d07ef8fb6cae80c832404b35e3ce
4
- data.tar.gz: 95245d11a85ef50539f86182cc458246178ffb24ff409bd04fbef9a0a23342ef
3
+ metadata.gz: 91f1b98200a2be8ff60cd36c8f8c3f8186505ddf78642baa92e9a3f964de7018
4
+ data.tar.gz: a930895cae5b9a4c93ce563394d11f1dce7b9de73365983ce5d9ca0f253d99f6
5
5
  SHA512:
6
- metadata.gz: a8eed2636ad7735accf3e3f6bacbcb16bae84514b3503e718eb96426ca0bbe6a39a06a9ea06727714b6e578ac4a3bd9ddd6fe76f9bebb4c1d63c084b3503c44b
7
- data.tar.gz: 2d1c1cf87cef36cdcb196cab0c135970020389462b99b0ff8447dcefe3ae1f381da31a93ad29a34fedbfd6134eeba2b8c58a3ee30069021c74e3972a857f5950
6
+ metadata.gz: d50ad9535e6b36eefb147ffeadfbe91db4ade2bbf78be6a0ec42a6c9343f2528396ff619a1ce2414f6e7ea27df770e0e691aadf0f5cac79bb10c3cbba5c2b558
7
+ data.tar.gz: 7978033d3e0a99dda1837d4de3e5f88e8a7a23d0577f7c0e3a281cb3c2cb3d733fb724c5f2488f5b1222601127cb87448cb2f0a4480ebe523b4a1ee9e55d307e
data/CHANGELOG.md CHANGED
@@ -1,6 +1,25 @@
1
1
  # Changelog
2
2
 
3
- ## [0.0.8](https://github.com/puppetlabs/dropsonde/tree/0.0.8) (2022-08-29)
3
+ ## [0.1.0](https://github.com/OpenVoxProject/dropsonde/tree/0.1.0) (2025-06-10)
4
+
5
+ [Full Changelog](https://github.com/OpenVoxProject/dropsonde/compare/v0.0.8...0.1.0)
6
+
7
+ **Breaking changes:**
8
+
9
+ - remove and abstract Puppet dependency; manually require the gem you want to use [\#1](https://github.com/OpenVoxProject/dropsonde/pull/1) ([binford2k](https://github.com/binford2k))
10
+
11
+ **Fixed bugs:**
12
+
13
+ - Fix a couple nil references [\#5](https://github.com/OpenVoxProject/dropsonde/pull/5) ([binford2k](https://github.com/binford2k))
14
+ - fix broken acceptance test [\#4](https://github.com/OpenVoxProject/dropsonde/pull/4) ([binford2k](https://github.com/binford2k))
15
+
16
+ **Merged pull requests:**
17
+
18
+ - dependabot: check for github actions and bundler [\#6](https://github.com/OpenVoxProject/dropsonde/pull/6) ([bastelfreak](https://github.com/bastelfreak))
19
+ - workflow housekeeping [\#3](https://github.com/OpenVoxProject/dropsonde/pull/3) ([binford2k](https://github.com/binford2k))
20
+ - No need to run specs nightly [\#2](https://github.com/OpenVoxProject/dropsonde/pull/2) ([binford2k](https://github.com/binford2k))
21
+
22
+ ## [v0.0.8](https://github.com/puppetlabs/dropsonde/tree/0.0.8) (2022-08-29)
4
23
 
5
24
  [Full Changelog](https://github.com/puppetlabs/dropsonde/compare/v0.0.7...0.0.8)
6
25
 
data/bin/dropsonde CHANGED
@@ -69,14 +69,14 @@ class Dropsonde
69
69
  desc 'Submit a telemetry report'
70
70
  command :submit do |c|
71
71
  c.desc 'Telemetry endpoint'
72
- c.flag [:endpoint], :default_value => 'https://updates.puppet.com'
72
+ c.flag [:endpoint]
73
73
 
74
74
  c.desc 'Telemetry port'
75
- c.flag [:port], :default_value => 443, :type => Integer
75
+ c.flag [:port], :type => Integer
76
76
 
77
77
  c.action do |global, options, args|
78
78
  @cache.autoupdate
79
- Dropsonde.submit_report(options[:endpoint], options[:port])
79
+ Dropsonde.submit_report(options)
80
80
  end
81
81
  end
82
82
 
@@ -128,7 +128,7 @@ class Dropsonde::Metrics::Modules
128
128
  end
129
129
  }.flatten.compact.uniq
130
130
 
131
- if puppetdb_session
131
+ if puppetdb_session&.puppet_db
132
132
  # classes and how many nodes they're enforced on
133
133
  results = puppetdb_session.puppet_db.request('', 'resources[type, title] { type = "Class" }').data
134
134
 
@@ -54,7 +54,7 @@ class Dropsonde::Metrics::Platforms
54
54
 
55
55
  def self.run(puppetdb_session = nil)
56
56
  # skip this metric if we don't have an active PuppetDB connection
57
- return unless puppetdb_session
57
+ return unless puppetdb_session&.puppet_db
58
58
 
59
59
  classes = puppetdb_session.puppet_db.request('', 'resources[certname, title] { type = "Class" }').data
60
60
  facts = puppetdb_session.puppet_db.request('', 'facts[certname, value] { name = "osfamily" }').data
@@ -52,7 +52,7 @@ class Dropsonde::Metrics
52
52
 
53
53
  def schema
54
54
  schema = skeleton_schema
55
- Dropsonde::Metrics.plugins.each do |_name, plugin|
55
+ Dropsonde::Metrics.plugins.each_value do |plugin|
56
56
  schema.concat(sanity_check_schema(plugin))
57
57
  end
58
58
  check_for_duplicates(schema)
@@ -62,7 +62,7 @@ class Dropsonde::Metrics
62
62
  def preview(puppetdb_session = nil)
63
63
  str = " Puppet Telemetry Report Preview\n"
64
64
  str += " ===============================\n\n"
65
- Dropsonde::Metrics.plugins.each do |_name, plugin|
65
+ Dropsonde::Metrics.plugins.each_value do |plugin|
66
66
  schema = plugin.schema
67
67
 
68
68
  plugin.setup if plugin.respond_to? :setup
@@ -91,7 +91,7 @@ class Dropsonde::Metrics
91
91
 
92
92
  def report(puppetdb_session = nil)
93
93
  snapshots = {}
94
- Dropsonde::Metrics.plugins.each do |_name, plugin|
94
+ Dropsonde::Metrics.plugins.each_value do |plugin|
95
95
  plugin.setup
96
96
  sanity_check_data(plugin, plugin.run(puppetdb_session)).each do |row|
97
97
  snapshots[row.keys.first] = {
@@ -115,7 +115,7 @@ class Dropsonde::Metrics
115
115
  results[:ip] = IPAddr.new(rand(2**32), Socket::AF_INET)
116
116
  results.delete(:'self-service-analytics')
117
117
 
118
- Dropsonde::Metrics.plugins.each do |_name, plugin|
118
+ Dropsonde::Metrics.plugins.each_value do |plugin|
119
119
  sanity_check_data(plugin, plugin.example).each do |row|
120
120
  results.merge!(row)
121
121
  end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This uses Puppet's standard Dujour telemetry endpoint.
4
+ # It currently expects a report formatted precisely to meet Dujour's odd schema.
5
+ # At some point, we'll define our own report format and this submitter will
6
+ # transform it to meet the expected schema.
7
+ #
8
+ # This is currently the only operational submitter.
9
+ class Dropsonde::Submitter::Dujour
10
+ def self.submit_report(options)
11
+ client = HTTPClient.new
12
+
13
+ endpoint = options[:endpoint] || Dropsonde.settings[:endpoint] || 'https://updates.puppet.com'
14
+ port = options[:port] || Dropsonde.settings[:port] || 443
15
+
16
+ # The httpclient gem ships with some expired CA certificates.
17
+ # This causes us to load the certs shipped with whatever
18
+ # Ruby is used to execute this gem's commands, which are generally
19
+ # more up-to-date, especially if using puppet-agent's Ruby.
20
+ #
21
+ # Note that this is no-op with Windows system Ruby.
22
+ client.ssl_config.set_default_paths
23
+
24
+ result = client.post("#{endpoint}:#{port}",
25
+ header: { 'Content-Type' => 'application/json' },
26
+ body: Dropsonde::Metrics.new.report.to_json)
27
+
28
+ if result.status == 200
29
+ data = JSON.parse(result.body)
30
+ if data['newer']
31
+ puts 'A newer version of the telemetry client is available:'
32
+ puts " -- #{data['link']}"
33
+ else
34
+ puts data['message']
35
+ end
36
+ else
37
+ puts 'Failed to submit report'
38
+ puts JSON.pretty_generate(result.body) if Dropsonde.settings[:verbose]
39
+ exit 1
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This currently doesn't actually exist.
4
+ # It's just a placeholder for someday when it does exist!
5
+ class Dropsonde::Submitter::OpenTelemetry
6
+ def self.submit_report(options)
7
+ puts 'When Vox Pupuli has its own telemetry server, this will post there.'
8
+ puts options.inspect
9
+ end
10
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Dropsonde
4
- VERSION = '0.0.8'
4
+ VERSION = '0.1.0'
5
5
  end
data/lib/dropsonde.rb CHANGED
@@ -4,7 +4,12 @@ require 'json'
4
4
  require 'httpclient'
5
5
  require 'puppetdb'
6
6
  require 'inifile'
7
- require 'puppet'
7
+
8
+ begin
9
+ require 'puppet'
10
+ rescue LoadError
11
+ raise 'Please install either Puppet or OpenVox gem to use this tool.'
12
+ end
8
13
 
9
14
  # This class handles caching module process, generate reports,
10
15
  # fetchs all plugins defined in lib/dropsonde/metrics and also
@@ -15,6 +20,9 @@ class Dropsonde
15
20
  require 'dropsonde/monkeypatches'
16
21
  require 'dropsonde/version'
17
22
 
23
+ # This class abstracts the endpoint we submit to.
24
+ class Dropsonde::Submitter; end
25
+
18
26
  def self.puppet_settings_overrides
19
27
  overrides = []
20
28
  if (confdir = ENV['PUPPET_CONFDIR'])
@@ -75,33 +83,13 @@ class Dropsonde
75
83
  end
76
84
  end
77
85
 
78
- def self.submit_report(endpoint, port)
79
- client = HTTPClient.new
80
-
81
- # The httpclient gem ships with some expired CA certificates.
82
- # This causes us to load the certs shipped with whatever
83
- # Ruby is used to execute this gem's commands, which are generally
84
- # more up-to-date, especially if using puppet-agent's Ruby.
85
- #
86
- # Note that this is no-op with Windows system Ruby.
87
- client.ssl_config.set_default_paths
88
-
89
- result = client.post("#{endpoint}:#{port}",
90
- header: { 'Content-Type' => 'application/json' },
91
- body: Dropsonde::Metrics.new.report.to_json)
92
-
93
- if result.status == 200
94
- data = JSON.parse(result.body)
95
- if data['newer']
96
- puts 'A newer version of the telemetry client is available:'
97
- puts " -- #{data['link']}"
98
- else
99
- puts data['message']
100
- end
86
+ def self.submit_report(options)
87
+ if Puppet.respond_to?(:implementation) && Puppet.implementation == 'openvox'
88
+ require 'dropsonde/submitter/open_telemetry'
89
+ Dropsonde::Submitter::OpenTelemetry.submit_report(options)
101
90
  else
102
- puts 'Failed to submit report'
103
- puts JSON.pretty_generate(result.body) if Dropsonde.settings[:verbose]
104
- exit 1
91
+ require 'dropsonde/submitter/dujour'
92
+ Dropsonde::Submitter::Dujour.submit_report(options)
105
93
  end
106
94
  end
107
95
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dropsonde
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Ford
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-29 00:00:00.000000000 Z
11
+ date: 2025-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -66,20 +66,6 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: puppet
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: puppet_forge
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -140,7 +126,7 @@ description: |
140
126
  Dropsonde is a simple telemetry probe designed to run as a regular cron job. It
141
127
  will gather metrics defined by self-contained plugins that each defines its own
142
128
  partial schema and then gathers the data to meet that schema.
143
- email: ben.ford@puppet.com
129
+ email: binford2k@overlookinfratech.com
144
130
  executables:
145
131
  - dropsonde
146
132
  extensions: []
@@ -159,12 +145,16 @@ files:
159
145
  - lib/dropsonde/metrics/platforms.rb
160
146
  - lib/dropsonde/metrics/puppetfiles.rb
161
147
  - lib/dropsonde/monkeypatches.rb
148
+ - lib/dropsonde/submitter/dujour.rb
149
+ - lib/dropsonde/submitter/open_telemetry.rb
162
150
  - lib/dropsonde/version.rb
163
- homepage: https://github.com/puppetlabs/dropsonde
151
+ homepage: https://github.com/OpenVoxProject/dropsonde
164
152
  licenses:
165
153
  - Apache-2.0
166
154
  metadata: {}
167
- post_install_message:
155
+ post_install_message: |
156
+ For portability reasons, this gem no longer depends on Puppet. You will need to
157
+ install either Puppet or OpenVox gems manually.
168
158
  rdoc_options: []
169
159
  require_paths:
170
160
  - lib
@@ -179,8 +169,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
169
  - !ruby/object:Gem::Version
180
170
  version: '0'
181
171
  requirements: []
182
- rubygems_version: 3.1.6
183
- signing_key:
172
+ rubygems_version: 3.4.19
173
+ signing_key:
184
174
  specification_version: 4
185
- summary: A simple telemetry probe for gathering usage information about Puppet infrastructures.
175
+ summary: A simple telemetry probe for gathering usage information about OpenVox and
176
+ Puppet infrastructures.
186
177
  test_files: []