inspec-rabbitmq-resources 7.1.3
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 +7 -0
- data/Gemfile +19 -0
- data/README.md +16 -0
- data/inspec-rabbitmq-resources.gemspec +44 -0
- data/inspec.yml +10 -0
- data/lib/inspec-rabbitmq-resources/plugin.rb +43 -0
- data/lib/inspec-rabbitmq-resources/resource_pack.rb +16 -0
- data/lib/inspec-rabbitmq-resources/resources/rabbitmq_conf.rb +3 -0
- data/lib/inspec-rabbitmq-resources/resources/rabbitmq_config.rb +54 -0
- data/lib/inspec-rabbitmq-resources/version.rb +9 -0
- data/lib/inspec-rabbitmq-resources.rb +15 -0
- metadata +67 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 8a2a06f4ac9eb44f19dd30cf0a64f31b7ba8578e44e07634e573f1f7a5474c9d
|
|
4
|
+
data.tar.gz: 98b90a6c806c8135a301bc3d010b057a1e1db7fe59667140669f6e6b7a1f841e
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 79940a1e4f86d6e37ecd694167394cb70424b5703aac5971e94a7ed5af3c0c177e348d3996ff049c5c46fa2090726d566a0d7bd614013f45300e1ef768817afe
|
|
7
|
+
data.tar.gz: ae9de4d3c7b0bf4c2828bd1a7b8cc84bb34073e7a9b0a27499b84ae276780d29cc781b9c6216661f35b2f06f3ccd087539f2ea553398a7113dd317028e8de980
|
data/Gemfile
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
source "https://rubygems.org"
|
|
4
|
+
gem "inspec", git: "https://github.com/inspec/inspec", branch: "inspec-7"
|
|
5
|
+
gem "inspec-bin", git: "https://github.com/inspec/inspec", branch: "inspec-7"
|
|
6
|
+
|
|
7
|
+
gemspec
|
|
8
|
+
|
|
9
|
+
group :test do
|
|
10
|
+
gem "byebug"
|
|
11
|
+
gem "chefstyle"
|
|
12
|
+
gem "minitest"
|
|
13
|
+
gem "minitest-sprint"
|
|
14
|
+
gem "m"
|
|
15
|
+
gem "mocha"
|
|
16
|
+
gem "rake"
|
|
17
|
+
gem "simplecov"
|
|
18
|
+
gem "simplecov_json_formatter"
|
|
19
|
+
end
|
data/README.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# inspec-rabbitmq-resources
|
|
2
|
+
|
|
3
|
+
RabbitMQ InSpec Resources in a Gem
|
|
4
|
+
|
|
5
|
+
This repository contains the InSpec RabbitMQ resources, formerly contained in InSpec Core. In InSpec 7+, these resources are available in a gem, `inspec-rabbitmq-resources`.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
To use this resource pack, add this dependency to your inspec.yml :
|
|
10
|
+
|
|
11
|
+
```yaml
|
|
12
|
+
depends:
|
|
13
|
+
- name: inspec-rabbitmq-resources
|
|
14
|
+
gem: inspec-rabbitmq-resources
|
|
15
|
+
```
|
|
16
|
+
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# As plugins are usually packaged and distributed as a RubyGem,
|
|
2
|
+
# we have to provide a .gemspec file, which controls the gembuild
|
|
3
|
+
# and publish process. This is a fairly generic gemspec.
|
|
4
|
+
|
|
5
|
+
# It is traditional in a gemspec to dynamically load the current version
|
|
6
|
+
# from a file in the source tree. The next three lines make that happen.
|
|
7
|
+
lib = File.expand_path("lib", __dir__)
|
|
8
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
9
|
+
require "inspec-rabbitmq-resources/version"
|
|
10
|
+
|
|
11
|
+
Gem::Specification.new do |spec|
|
|
12
|
+
# Importantly, all InSpec plugins must be prefixed with `inspec-` (most
|
|
13
|
+
# plugins) or `train-` (plugins which add new connectivity features).
|
|
14
|
+
spec.name = "inspec-rabbitmq-resources"
|
|
15
|
+
|
|
16
|
+
# It is polite to namespace your plugin under InspecPlugins::YourPluginInCamelCase
|
|
17
|
+
spec.version = InspecPlugins::RabbitmqResources::VERSION
|
|
18
|
+
spec.authors = ["InSpec Core Maintainers"]
|
|
19
|
+
spec.email = ["inspec@progress.com"]
|
|
20
|
+
spec.summary = "Rabbitmq InSpec Resources in a Gem"
|
|
21
|
+
spec.description = "Contains InSpec 7.0+ resources fo interacting with Rabbitmq Resources."
|
|
22
|
+
spec.homepage = "https://github.com/inspec/inspec-rabbitmq-resources"
|
|
23
|
+
spec.license = "Apache-2.0"
|
|
24
|
+
|
|
25
|
+
# Though complicated-looking, this is pretty standard for a gemspec.
|
|
26
|
+
# It just filters what will actually be packaged in the gem (leaving
|
|
27
|
+
# out tests, etc)
|
|
28
|
+
spec.files = %w{
|
|
29
|
+
README.md inspec-rabbitmq-resources.gemspec Gemfile inspec.yml
|
|
30
|
+
} + Dir.glob(
|
|
31
|
+
"lib/**/*", File::FNM_DOTMATCH
|
|
32
|
+
).reject { |f| File.directory?(f) }
|
|
33
|
+
spec.require_paths = ["lib"]
|
|
34
|
+
|
|
35
|
+
spec.required_ruby_version = ">= 3.1.0"
|
|
36
|
+
|
|
37
|
+
# If you rely on any other gems, list them here with any constraints.
|
|
38
|
+
# This is how `inspec plugin install` is able to manage your dependencies.
|
|
39
|
+
# For example, perhaps you are writing a thing that talks to AWS, and you
|
|
40
|
+
# want to ensure you have `aws-sdk` in a certain version.
|
|
41
|
+
|
|
42
|
+
# This plugin uses InSpec 7 Resource Pack Plugins
|
|
43
|
+
spec.add_dependency "inspec-core", ">= 7.0"
|
|
44
|
+
end
|
data/inspec.yml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
name: inspec-rabbitmq-resources
|
|
2
|
+
title: Resource pack gem for RabbitmqResources
|
|
3
|
+
maintainer: InSpec Core Maintainers
|
|
4
|
+
copyright: Progress Software Corporation
|
|
5
|
+
copyright_email: inspec@progress.com
|
|
6
|
+
license: ApacheV2
|
|
7
|
+
summary: Rabbitmq InSpec Resources in a Gem
|
|
8
|
+
version: 7.1.3
|
|
9
|
+
supports:
|
|
10
|
+
platform: os
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Plugin Definition file
|
|
3
|
+
# The purpose of this file is to declare to InSpec what plugin_types (capabilities)
|
|
4
|
+
# are included in this plugin, and provide activator that will load them as needed.
|
|
5
|
+
|
|
6
|
+
# It is important that this file load successfully and *quickly*.
|
|
7
|
+
# Your plugin's functionality may never be used on this InSpec run; so we keep things
|
|
8
|
+
# fast and light by only loading heavy things when they are needed.
|
|
9
|
+
|
|
10
|
+
# Presumably this is light
|
|
11
|
+
require "inspec-rabbitmq-resources/version"
|
|
12
|
+
|
|
13
|
+
# The InspecPlugins namespace is where all plugins should declare themselves.
|
|
14
|
+
# The "Inspec" capitalization is used throughout the InSpec source code; yes, it's
|
|
15
|
+
# strange.
|
|
16
|
+
module InspecPlugins
|
|
17
|
+
# Pick a reasonable namespace here for your plugin. A reasonable choice
|
|
18
|
+
# would be the CamelCase version of your plugin gem name.
|
|
19
|
+
# inspec-test-resources => TestResources
|
|
20
|
+
module RabbitmqResources
|
|
21
|
+
# This simple class handles the plugin definition, so calling it simply Plugin is OK.
|
|
22
|
+
# Inspec.plugin returns various Classes, intended to be superclasses for various
|
|
23
|
+
# plugin components. Here, the one-arg form gives you the Plugin Definition superclass,
|
|
24
|
+
# which mainly gives you access to the activator / plugin_type DSL.
|
|
25
|
+
# The number '2' says you are asking for version 2 of the plugin API. If there are
|
|
26
|
+
# future versions, InSpec promises plugin API v2 will work for at least two more InSpec
|
|
27
|
+
# major versions.
|
|
28
|
+
class Plugin < ::Inspec.plugin(2)
|
|
29
|
+
# Internal machine name of the plugin. InSpec will use this in errors, etc.
|
|
30
|
+
plugin_name :"inspec-rabbitmq-resources"
|
|
31
|
+
|
|
32
|
+
# Define a new Resource Pack.
|
|
33
|
+
resource_pack :"inspec-rabbitmq-resources" do
|
|
34
|
+
# This file will load the resources implicitly via the superclass
|
|
35
|
+
require "inspec-rabbitmq-resources/resource_pack"
|
|
36
|
+
|
|
37
|
+
# Having loaded our functionality, return a class that represents the plugin.
|
|
38
|
+
# Reserved for future use.
|
|
39
|
+
InspecPlugins::RabbitmqResources::ResourcePack
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require "inspec/resource"
|
|
3
|
+
|
|
4
|
+
module InspecPlugins::RabbitmqResources
|
|
5
|
+
# This class will provide the actual CLI implementation.
|
|
6
|
+
# Its superclass is provided by another call to Inspec.plugin,
|
|
7
|
+
# this time with two args. The first arg specifies we are requesting
|
|
8
|
+
# version 2 of the Plugins API. The second says we are making a Resource
|
|
9
|
+
# Pack plugin component, so please make available any DSL needed
|
|
10
|
+
# for that.
|
|
11
|
+
class ResourcePack < Inspec.plugin(2, :resource_pack)
|
|
12
|
+
# TBD
|
|
13
|
+
# load_timing :early <-- isn't that implicit in the rewuire statements
|
|
14
|
+
# train relationship declarations? <-- that should be in the gemspec
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
require "inspec/utils/erlang_parser"
|
|
2
|
+
require "inspec/utils/file_reader"
|
|
3
|
+
|
|
4
|
+
class RabbitmqConfig < Inspec.resource(1)
|
|
5
|
+
name "rabbitmq_conf" # TODO: this is an alias. do we want this?
|
|
6
|
+
name "rabbitmq_config"
|
|
7
|
+
supports platform: "unix"
|
|
8
|
+
desc "Use the rabbitmq_config InSpec resource to test configuration data "\
|
|
9
|
+
"for the RabbitMQ service located in /etc/rabbitmq/rabbitmq.config on "\
|
|
10
|
+
"Linux and UNIX platforms."
|
|
11
|
+
example <<~EXAMPLE
|
|
12
|
+
describe rabbitmq_config.params('rabbit', 'ssl_listeners') do
|
|
13
|
+
it { should cmp 5671 }
|
|
14
|
+
end
|
|
15
|
+
EXAMPLE
|
|
16
|
+
|
|
17
|
+
include FileReader
|
|
18
|
+
|
|
19
|
+
def initialize(conf_path = nil)
|
|
20
|
+
@conf_path = conf_path || "/etc/rabbitmq/rabbitmq.config"
|
|
21
|
+
@content = read_file_content(@conf_path, allow_empty: true)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def params(*opts)
|
|
25
|
+
opts.inject(read_params) do |res, nxt|
|
|
26
|
+
res.respond_to?(:key) ? res[nxt] : nil
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def to_s
|
|
31
|
+
"rabbitmq_config #{@conf_path}"
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def resource_id
|
|
35
|
+
@conf_path
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
private
|
|
39
|
+
|
|
40
|
+
def read_content
|
|
41
|
+
return @content if defined?(@content)
|
|
42
|
+
|
|
43
|
+
@content = read_file_content(@conf_path, allow_empty: true)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def read_params
|
|
47
|
+
return @params if defined?(@params)
|
|
48
|
+
return @params = {} if read_content.nil?
|
|
49
|
+
|
|
50
|
+
@params = ErlangConfigFile.parse(read_content)
|
|
51
|
+
rescue Parslet::ParseFailed
|
|
52
|
+
raise "Cannot parse RabbitMQ config: \"#{read_content}\""
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file simply makes it easier for CI engines to update
|
|
3
|
+
# the version stamp, and provide a clean way for the gemspec
|
|
4
|
+
# to learn the current version.
|
|
5
|
+
module InspecPlugins
|
|
6
|
+
module RabbitmqResources
|
|
7
|
+
VERSION = "7.1.3"
|
|
8
|
+
end
|
|
9
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is known as the "entry point."
|
|
3
|
+
# This is the file InSpec will try to load if it
|
|
4
|
+
# thinks your plugin is installed.
|
|
5
|
+
|
|
6
|
+
# The *only* thing this file should do is setup the
|
|
7
|
+
# load path, then load the plugin definition file.
|
|
8
|
+
|
|
9
|
+
# Next two lines simply add the path of the gem to the load path.
|
|
10
|
+
# This is not needed when being loaded as a gem; but when doing
|
|
11
|
+
# plugin development, you may need it. Either way, it's harmless.
|
|
12
|
+
libdir = File.dirname(__FILE__)
|
|
13
|
+
$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
|
|
14
|
+
|
|
15
|
+
require "inspec-rabbitmq-resources/plugin"
|
metadata
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: inspec-rabbitmq-resources
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 7.1.3
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- InSpec Core Maintainers
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2025-10-10 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: inspec-core
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '7.0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '7.0'
|
|
27
|
+
description: Contains InSpec 7.0+ resources fo interacting with Rabbitmq Resources.
|
|
28
|
+
email:
|
|
29
|
+
- inspec@progress.com
|
|
30
|
+
executables: []
|
|
31
|
+
extensions: []
|
|
32
|
+
extra_rdoc_files: []
|
|
33
|
+
files:
|
|
34
|
+
- Gemfile
|
|
35
|
+
- README.md
|
|
36
|
+
- inspec-rabbitmq-resources.gemspec
|
|
37
|
+
- inspec.yml
|
|
38
|
+
- lib/inspec-rabbitmq-resources.rb
|
|
39
|
+
- lib/inspec-rabbitmq-resources/plugin.rb
|
|
40
|
+
- lib/inspec-rabbitmq-resources/resource_pack.rb
|
|
41
|
+
- lib/inspec-rabbitmq-resources/resources/rabbitmq_conf.rb
|
|
42
|
+
- lib/inspec-rabbitmq-resources/resources/rabbitmq_config.rb
|
|
43
|
+
- lib/inspec-rabbitmq-resources/version.rb
|
|
44
|
+
homepage: https://github.com/inspec/inspec-rabbitmq-resources
|
|
45
|
+
licenses:
|
|
46
|
+
- Apache-2.0
|
|
47
|
+
metadata: {}
|
|
48
|
+
post_install_message:
|
|
49
|
+
rdoc_options: []
|
|
50
|
+
require_paths:
|
|
51
|
+
- lib
|
|
52
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
53
|
+
requirements:
|
|
54
|
+
- - ">="
|
|
55
|
+
- !ruby/object:Gem::Version
|
|
56
|
+
version: 3.1.0
|
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
requirements: []
|
|
63
|
+
rubygems_version: 3.3.27
|
|
64
|
+
signing_key:
|
|
65
|
+
specification_version: 4
|
|
66
|
+
summary: Rabbitmq InSpec Resources in a Gem
|
|
67
|
+
test_files: []
|