Skip to content
This repository has been archived by the owner on Jan 29, 2022. It is now read-only.

Commit

Permalink
Rubocop fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dhollinger committed Feb 4, 2018
1 parent ab2c781 commit 115a7c7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
4 changes: 2 additions & 2 deletions lib/helpers/deployments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ def deploy_module(module_name)
result = PuppetWebhook::Mcollective.new('r10k',
'deploy',
{
dtimeoute: settings.discovery_timeout,
timeout: settings.client_timeout
dtimeoute: settings.discovery_timeout,
timeout: settings.client_timeout
},
settings.client_cfg,
module: module_name).run.first
Expand Down
5 changes: 3 additions & 2 deletions lib/plugins/mcollective.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
require 'mcollective'

class PuppetWebhook
# Creates an Mcollective Agent object for running MCO agents
class Mcollective
attr_writer :agent, :command
include MCollective::RPC

def initialize(agent, command, timeouts = nil, options = nil, nodes = [], **args)
def initialize(agent, command, timeouts = nil, options = nil, nodes = [], **args) # rubocop:disable Metrics/ParameterLists
@agent = agent
@command = command
@timeout = timeouts[:timeout] || '120'
Expand All @@ -22,7 +23,7 @@ def run
client.send(@command, @args) do |result|
result
end
rescue => e
rescue StandardError => e
LOGGER.error("Error: #{e}")
end
end
Expand Down
18 changes: 9 additions & 9 deletions spec/unit/plugins/webhook_mcollective_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@
end
it 'should run correctly' do
result_data = {
:agent => 'puppet',
:action => 'disable',
:sender => 'example.net',
:statuscode => 0,
:statusmsg => 'OK',
:data => {
:status => "Succesfully locked the Puppet agent: Disabled via MCollective by choria=vp.mcollective at 2017-12-25 07:59",
:enabled => false
agent: 'puppet',
action: 'disable',
sender: 'example.net',
statuscode: 0,
statusmsg: 'OK',
data: {
status: 'Succesfully locked the Puppet agent: Disabled via MCollective by choria=vp.mcollective at 2017-12-25 07:59',
enabled: false
}
}

allow(PuppetWebhook::Mcollective).to receive(:run).and_return(result_data)
expect(PuppetWebhook::Mcollective.run).to eq(result_data)
end
end
end
end

0 comments on commit 115a7c7

Please sign in to comment.