Dist branding for plugins/inspec-artifact

Signed-off-by: Artem Sidorenko <artem.sidorenko@t-systems.com>
This commit is contained in:
Artem Sidorenko 2019-05-24 12:41:34 +02:00
parent 5a2bf961f8
commit 4c0260aedd
2 changed files with 9 additions and 3 deletions

View file

@ -4,10 +4,13 @@ require 'pathname'
require 'set' require 'set'
require 'tempfile' require 'tempfile'
require 'yaml' require 'yaml'
require 'inspec/dist'
module InspecPlugins module InspecPlugins
module Artifact module Artifact
class Base class Base
include Inspec::Dist
KEY_BITS=2048 KEY_BITS=2048
KEY_ALG=OpenSSL::PKey::RSA KEY_ALG=OpenSSL::PKey::RSA
@ -87,7 +90,7 @@ module InspecPlugins
p = Pathname.new(path_to_profile) p = Pathname.new(path_to_profile)
p = p.join('inspec.yml') p = p.join('inspec.yml')
if not p.exist? if not p.exist?
raise "#{path_to_profile} doesn't appear to be a valid InSpec profile" raise "#{path_to_profile} doesn't appear to be a valid #{PRODUCT_NAME} profile"
end end
yaml = YAML.load_file(p.to_s) yaml = YAML.load_file(p.to_s)
yaml = yaml.to_hash yaml = yaml.to_hash
@ -101,7 +104,7 @@ module InspecPlugins
end end
rescue => e rescue => e
# rewrap it and pass it up to the CLI # rewrap it and pass it up to the CLI
raise "Error reading InSpec profile metadata: #{e}" raise "Error reading #{PRODUCT_NAME} profile metadata: #{e}"
end end
yaml yaml

View file

@ -1,4 +1,5 @@
require_relative 'base' require_relative 'base'
require 'inspec/dist'
# #
# Notes: # Notes:
@ -72,7 +73,9 @@ require_relative 'base'
module InspecPlugins module InspecPlugins
module Artifact module Artifact
class CLI < Inspec.plugin(2, :cli_command) class CLI < Inspec.plugin(2, :cli_command)
subcommand_desc 'artifact SUBCOMMAND', 'Manage InSpec Artifacts' include Inspec::Dist
subcommand_desc 'artifact SUBCOMMAND', "Manage #{PRODUCT_NAME} Artifacts"
desc 'generate', 'Generate a RSA key pair for signing and verification' desc 'generate', 'Generate a RSA key pair for signing and verification'
option :keyname, type: :string, required: true, option :keyname, type: :string, required: true,