From f6ceacadc7b9e1f2a6d65abc39aa8bda66a20f85 Mon Sep 17 00:00:00 2001 From: Adam Gibbins Date: Wed, 19 Feb 2020 14:25:36 +0000 Subject: [PATCH] Fix 'stacks test' --- Dockerfile | 6 ++-- Gemfile | 2 +- mcollective_plugins/agent/nrpe.ddl | 52 ++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 mcollective_plugins/agent/nrpe.ddl diff --git a/Dockerfile b/Dockerfile index db67cb3b..156bed3d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,10 +4,10 @@ FROM ruby:${ruby_version}-alpine as build RUN apk add --no-cache make gcc libc-dev -WORKDIR /build +WORKDIR /root COPY Gemfile Gemfile.lock ./ -WORKDIR /build/vendor/bundle/ruby +WORKDIR /root/vendor/bundle/ruby RUN bundle install --no-cache --deployment --without development && \ rm -rf ./*/cache ./*/gems/*/spec/* ./*/gems/*/tests/* @@ -29,7 +29,7 @@ RUN chmod +x /usr/local/bin/kubectl && \ WORKDIR /root -COPY --from=build /build /root +COPY --from=build /root /root COPY --from=build /usr/local/bundle /usr/local/bundle COPY bin /usr/local/bin/ diff --git a/Gemfile b/Gemfile index e486b13b..cfe61d2d 100644 --- a/Gemfile +++ b/Gemfile @@ -3,13 +3,13 @@ source 'https://rubygems.org' gem 'collimator', '0.0.3' gem 'mcollective-client', '2.8.2' gem 'puppet', '3.7.5' +gem 'rspec', '3.3.0' # used by stacks test command group :development do gem 'ci_reporter_rspec', '1.0.0' gem 'pry' gem 'pry-byebug' gem 'rake', '10.1.0' - gem 'rspec', '3.3.0' gem 'rubocop', '0.32.1' gem 'syck' if RUBY_VERSION.split('.').first.to_i > 1 end diff --git a/mcollective_plugins/agent/nrpe.ddl b/mcollective_plugins/agent/nrpe.ddl new file mode 100644 index 00000000..a8661b1a --- /dev/null +++ b/mcollective_plugins/agent/nrpe.ddl @@ -0,0 +1,52 @@ +metadata :name => "nrpe", + :description => "Agent to query NRPE commands via MCollective", + :author => "R.I.Pienaar", + :license => "Apache 2", + :version => "2.2", + :url => "http://projects.puppetlabs.com/projects/mcollective-plugins/wiki", + :timeout => 60 + + +action "runallcommands", :description => "Runs all NRPE commands" do + output :commands, + :description => "Output from the Nagios plugind", + :display_as => "Commands", + :default => "" +end + +action "runcommand", :description => "Run a NRPE command" do + input :command, + :prompt => "Command", + :description => "NRPE command to run", + :type => :string, + :validation => '\A[a-zA-Z0-9_-]+\z', + :optional => false, + :maxlength => 50 + + output :output, + :description => "Output from the Nagios plugin", + :display_as => "Output", + :default => "" + + output :exitcode, + :description => "Exit Code from the Nagios plugin", + :display_as => "Exit Code", + :default => 3 + + output :perfdata, + :description => "Performance Data from the Nagios plugin", + :display_as => "Performance Data", + :default => "" + + output :command, + :description => "Command that was run", + :display_as => "Command", + :default => "" + + if respond_to?(:summarize) + summarize do + aggregate nagios_states(:exitcode) + end + end +end +