fuey_client 0.4.4 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5fb665c8a62c200904e94bfbf2bd101a07e5d44d
4
- data.tar.gz: 61623da20ab3162b02d17fd331985999404d8de4
3
+ metadata.gz: 1c63aabe5fea48616819b21441c3188c677750e0
4
+ data.tar.gz: d810d07322f3b770f9357969137ea8feda7a7f90
5
5
  SHA512:
6
- metadata.gz: fe13631a474bfd9c84e3d5d68b95ff9c98738ae1009b0296ca35f8cffab395f70c2aa8b7e46a81e73a5e79ee37b63b1311ffc78a9c16df0b00d86372de71870f
7
- data.tar.gz: ad3715338a2e689a4cdcfdb495dcc44264960748c83a58041476a236a96cab48d6b3640014343fa2586f442151b76a5e639d7d2dbd26ef4c993955864a46ed35
6
+ metadata.gz: 6e7da4c3baee7259706cbff6a41c0cf0001d385e4d1fe15156ac23742687881eba9b3219b5100acfae88fab9a787d972a692f5cd7a1e6c2f7b471126a21120e0
7
+ data.tar.gz: b3be27e62d394e0e52430f0b51fad3213aee3eec65e2896bf082e23f32dd635d8cd29fb72b3607d89a0d8ec593831927123da0a418328b90fb7eaa65b16a4410
@@ -6,7 +6,7 @@ module Fuey
6
6
  attr_accessor :ashost, :sysnr, :client, :user, :passwd, :lang, :response
7
7
 
8
8
  def _execute
9
- result, response = Support::SAP.new(config).ping
9
+ result, @response = Support::SAP.new(config).ping
10
10
  if result
11
11
  self.pass
12
12
  else
@@ -15,13 +15,18 @@ module Fuey
15
15
  end
16
16
 
17
17
  def to_s
18
- %(RFC Ping #{ashost} with user #{user})
18
+ %(RFCPing #{ashost} with user #{user})
19
+ end
20
+
21
+ def status_message
22
+ return %(RFCPing #{state} for #{ashost}. #{@response}) if failed?
23
+ %(RFCPing #{state} for #{ashost}.)
19
24
  end
20
25
 
21
26
  def status
22
27
  {
23
28
  :settings => config.reject{|k,v| k == 'passwd'},
24
- :statusMessage => response || %(#{state} RFCPing for #{ashost})
29
+ :statusMessage => status_message
25
30
  }.merge(super)
26
31
  end
27
32
 
@@ -13,7 +13,7 @@ module Fuey
13
13
  end
14
14
 
15
15
  def _execute
16
- response = Support::ShellCommand.new(snmp_walk_command).execute
16
+ @response = Support::ShellCommand.new(snmp_walk_command).execute
17
17
  result = (response =~ /#{ip}/)
18
18
  if result
19
19
  self.pass
@@ -23,7 +23,7 @@ module Fuey
23
23
  end
24
24
 
25
25
  def status_message
26
- return %(#{state} #{snmp_walk_command}) if response.nil?
26
+ return %(SNMPWalk #{state} #{snmp_walk_command}) if @response.nil? || passed?
27
27
  %(SNMPWalk #{state}. #{response})
28
28
  end
29
29
 
@@ -18,7 +18,7 @@ module Fuey
18
18
  rescue Gem::LoadError
19
19
  return [false, %(Could not RFC Ping because the sapnwrfc gem is not available)]
20
20
  rescue Exception => caught
21
- return [false, caught]
21
+ return [false, caught.message]
22
22
  ensure
23
23
  conn.close unless conn.nil?
24
24
  end
@@ -1,3 +1,3 @@
1
1
  module FueyClient
2
- VERSION = "0.4.4"
2
+ VERSION = "0.5.0"
3
3
  end
@@ -25,6 +25,7 @@ describe Fuey::Inspections::RFCPing do
25
25
  Given { conn.stub(:ping).and_return([false, "RFC Ping failure msg"]) }
26
26
  When { rfc_ping.execute }
27
27
  Then { expect( rfc_ping ).to have_aborted }
28
+ And { expect( rfc_ping.status_message ).to end_with("RFC Ping failure msg") }
28
29
  end
29
30
 
30
31
  context "when the ping succeeds" do
@@ -33,5 +34,6 @@ describe Fuey::Inspections::RFCPing do
33
34
  Given { conn.stub(:ping).and_return([true, ""]) }
34
35
  When { rfc_ping.execute }
35
36
  Then { expect( rfc_ping ).to have_passed }
37
+ And { expect( rfc_ping.status_message ).to eql("RFCPing passed for 1.0.0.1.") }
36
38
  end
37
39
  end
@@ -17,12 +17,21 @@ describe Fuey::Inspections::SNMPWalk do
17
17
  WALK
18
18
  }
19
19
 
20
+ context "when the walk has not been run" do
21
+ Given (:ip) { '172.0.0.1' }
22
+ Given (:snmpwalk) { Fuey::Inspections::SNMPWalk.new(:name => name, :ip => ip, :agent => agent, :oid => oid) }
23
+ Then { expect( snmpwalk.status_message ).to end_with("snmpwalk -v1 -c public 172.16.0.100 1.2.9.2.5.3.5.7.111.0.2.0.1.0") }
24
+ And { expect( snmpwalk.status_message ).to start_with("SNMPWalk pending") }
25
+ end
26
+
20
27
  context "when the walk fails" do
21
28
  Given (:ip) { '172.0.0.1' }
22
29
  Given { Fuey::Inspections::Support::ShellCommand.stub(:new).with("snmpwalk -v1 -c public 172.16.0.100 1.2.9.2.5.3.5.7.111.0.2.0.1.0").and_return double("ShellCommand", :execute => walk_result) }
23
30
  Given (:snmpwalk) { Fuey::Inspections::SNMPWalk.new(:name => name, :ip => ip, :agent => agent, :oid => oid) }
24
31
  When { snmpwalk.execute }
25
32
  Then { expect( snmpwalk ).to have_aborted }
33
+ And { expect( snmpwalk.status_message ).to end_with(walk_result) }
34
+ And { expect( snmpwalk.status_message ).to start_with( "SNMPWalk failed" ) }
26
35
  end
27
36
 
28
37
  context "when the walk succeeds" do
@@ -31,6 +40,8 @@ describe Fuey::Inspections::SNMPWalk do
31
40
  Given (:snmpwalk) { Fuey::Inspections::SNMPWalk.new(:name => name, :ip => ip, :agent => agent, :oid => oid) }
32
41
  When { snmpwalk.execute }
33
42
  Then { expect( snmpwalk ).to have_passed }
43
+ And { expect( snmpwalk.status_message ).to end_with( "snmpwalk -v1 -c public 172.16.0.100 1.2.9.2.5.3.5.7.111.0.2.0.1.0" ) }
44
+ And { expect( snmpwalk.status_message ).to start_with( "SNMPWalk passed" ) }
34
45
  end
35
46
 
36
47
  context "when the walk specifies the version and community" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fuey_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Snyder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-26 00:00:00.000000000 Z
11
+ date: 2013-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: configurethis