fuey_client 0.4.4 → 0.5.0
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 +4 -4
- data/lib/fuey_client/fuey/inspections/rfc_ping.rb +8 -3
- data/lib/fuey_client/fuey/inspections/snmp_walk.rb +2 -2
- data/lib/fuey_client/fuey/inspections/support/sap.rb +1 -1
- data/lib/fuey_client/version.rb +1 -1
- data/spec/fuey_client/fuey/inspections/rfc_ping_spec.rb +2 -0
- data/spec/fuey_client/fuey/inspections/snmpwalk_spec.rb +11 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c63aabe5fea48616819b21441c3188c677750e0
|
4
|
+
data.tar.gz: d810d07322f3b770f9357969137ea8feda7a7f90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
%(
|
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 =>
|
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
|
|
data/lib/fuey_client/version.rb
CHANGED
@@ -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
|
+
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-
|
11
|
+
date: 2013-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: configurethis
|