fuey_client 0.2.2 → 0.3.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: be7924d6905aa2c005cf8901333e05e4e69c0506
4
+ data.tar.gz: 1031fb72585a366c8bb50b81e1cc2c528b11da48
5
+ SHA512:
6
+ metadata.gz: 50ab45692cadda8c34b8de9e3988a2cac54d4d42f17979f96234942c09df3dbf3a59a32a4368dc92184d763489e9eed7c11fa021419aa0ee6edaf2c5cb7bc2fe
7
+ data.tar.gz: df220051c9208c6835dfd696dbdc2d938e4466284b77d1553c074d8ee558b559ce24d8165025c469a642c479ac393a48fe4cf390336c06fc91ea8f722899ac28
@@ -8,11 +8,19 @@ notifications:
8
8
  traces:
9
9
  two_pings:
10
10
  - Ping:
11
- name: Google
12
- host: 8.8.8.8
11
+ name: "Google"
12
+ host: "8.8.8.8"
13
13
  - SNMPWalk:
14
14
  name: "VPNTunnel"
15
+ agent: "1.1.1.1"
15
16
  ip: "98.31.121.10"
16
17
  community: "public"
17
18
  oid: "1.1.0.2.0.1.9.4.131.9.2.7.7.1"
18
19
  version: "v1"
20
+ - RFCPing:
21
+ ashost: "1.0.0.1"
22
+ sysnr: "00"
23
+ client: "400"
24
+ user: "chud"
25
+ passwd: "gobrowns"
26
+ lang: "EN"
@@ -0,0 +1,32 @@
1
+ require "fuey_client/fuey/inspections/support/sap"
2
+ require "fuey_client/fuey/model_initializer"
3
+
4
+ module Fuey
5
+ module Inspections
6
+ class RFCPing
7
+ include ModelInitializer
8
+
9
+ attr_accessor :name, :ashost, :sysnr, :client, :user, :passwd, :lang
10
+
11
+ def execute
12
+ Support::SAP.new(config).ping
13
+ end
14
+
15
+ def to_s
16
+ %(RFC Ping #{ashost} with user #{user})
17
+ end
18
+
19
+ def config
20
+ {
21
+ 'ashost' => ashost,
22
+ 'sysnr' => sysnr,
23
+ 'client' => client,
24
+ 'user' => user,
25
+ 'passwd' => passwd,
26
+ 'lang' => lang
27
+ }
28
+ end
29
+ private :config
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,30 @@
1
+ module Fuey
2
+ module Inspections
3
+ module Support
4
+ class SAP
5
+ def initialize(config)
6
+ @config = config
7
+ end
8
+
9
+ def ping
10
+ gem 'sapnwrfc'
11
+ SAPNW::Base.config = @config
12
+ conn = SAPNW::Base.rfc_connect
13
+ attrib = conn.connection_attributes
14
+ fld = conn.discover("RFC_PING")
15
+ fl = fld.new_function_call
16
+ fl.invoke
17
+ true
18
+ rescue Gem::LoadError
19
+ Log.write %(Could not ping SAP instance. The sapnwrfc gem is not installed)
20
+ false
21
+ rescue Exception => caught
22
+ Log.write %(RFC Ping for #{config['ashost']} failed due to #{caught})
23
+ return false
24
+ ensure
25
+ conn.close unless conn.nil?
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -1,2 +1,3 @@
1
1
  require "fuey_client/fuey/inspections/ping"
2
+ require "fuey_client/fuey/inspections/rfc_ping"
2
3
  require "fuey_client/fuey/inspections/snmp_walk"
@@ -1,3 +1,3 @@
1
1
  module FueyClient
2
- VERSION = "0.2.2"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -1,6 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Fuey::Inspections::Ping do
4
+ it_behaves_like "an inspection"
5
+
4
6
  describe "#execute" do
5
7
  context "when the ping fails" do
6
8
  Given { Fuey::Log.should_receive(:write).with("[some-server] Pinging 172.0.0.1 failed.") }
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fuey::Inspections::RFCPing do
4
+ it_behaves_like "an inspection"
5
+
6
+ Given (:config) {
7
+ {
8
+ 'ashost' => '1.0.0.1',
9
+ 'sysnr' => "00",
10
+ 'client' => "400",
11
+ 'user' => 'chud',
12
+ 'passwd' => 'gobrowns',
13
+ 'lang' => 'EN'
14
+ }
15
+ }
16
+ Given (:rfc_ping) { Fuey::Inspections::RFCPing.new config }
17
+
18
+
19
+ context "when the ping fails" do
20
+ Given (:conn) { double Fuey::Inspections::Support::SAP }
21
+ Given { Fuey::Inspections::Support::SAP.should_receive(:new).with(config).and_return(conn) }
22
+ Given { conn.stub(:ping).and_return(false) }
23
+ When (:result) { rfc_ping.execute }
24
+ Then { expect( result ).to be_false }
25
+ end
26
+
27
+ context "when the ping succeeds" do
28
+ Given (:conn) { double Fuey::Inspections::Support::SAP }
29
+ Given { Fuey::Inspections::Support::SAP.should_receive(:new).with(config).and_return(conn) }
30
+ Given { conn.stub(:ping).and_return(true) }
31
+ When (:result) { rfc_ping.execute }
32
+ Then { expect( result ).to be_true }
33
+ end
34
+ end
@@ -1,6 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Fuey::Inspections::SNMPWalk do
4
+ it_behaves_like "an inspection"
4
5
 
5
6
  describe "#execute" do
6
7
  Given (:name) { 'some-tunnel' }
@@ -0,0 +1,14 @@
1
+ shared_examples "an inspection" do
2
+ describe "should initialize with a hash" do
3
+ Then { expect( described_class.new({}) ).to be_a(described_class) }
4
+ end
5
+
6
+ describe "should respond to #execute" do
7
+ Then { expect( described_class.new({}) ).to respond_to(:execute) }
8
+ end
9
+
10
+ describe "should have a name" do
11
+ When (:inspection) { described_class.new({:name => 'hong kong fuey'} ) }
12
+ Then { expect( inspection.name ).to eql('hong kong fuey') }
13
+ end
14
+ end
metadata CHANGED
@@ -1,108 +1,93 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: fuey_client
3
- version: !ruby/object:Gem::Version
4
- hash: 19
5
- prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- - 2
10
- version: 0.2.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Matt Snyder
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2013-08-15 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
11
+ date: 2013-08-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
21
14
  name: configurethis
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 29
29
- segments:
30
- - 1
31
- - 0
32
- - 5
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
33
19
  version: 1.0.5
34
20
  type: :runtime
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: net-ping
38
21
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
40
- none: false
41
- requirements:
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 1.0.5
27
+ - !ruby/object:Gem::Dependency
28
+ name: net-ping
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
42
31
  - - ~>
43
- - !ruby/object:Gem::Version
44
- hash: 3
45
- segments:
46
- - 1
47
- - 6
48
- version: "1.6"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.6'
49
34
  type: :runtime
50
- version_requirements: *id002
51
- - !ruby/object:Gem::Dependency
52
- name: activesupport
53
35
  prerelease: false
54
- requirement: &id003 !ruby/object:Gem::Requirement
55
- none: false
56
- requirements:
57
- - - "="
58
- - !ruby/object:Gem::Version
59
- hash: 7
60
- segments:
61
- - 3
62
- - 0
63
- - 0
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: activesupport
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
64
47
  version: 3.0.0
65
48
  type: :runtime
66
- version_requirements: *id003
67
- - !ruby/object:Gem::Dependency
68
- name: bundler
69
49
  prerelease: false
70
- requirement: &id004 !ruby/object:Gem::Requirement
71
- none: false
72
- requirements:
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 3.0.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
73
59
  - - ~>
74
- - !ruby/object:Gem::Version
75
- hash: 9
76
- segments:
77
- - 1
78
- - 3
79
- version: "1.3"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.3'
80
62
  type: :development
81
- version_requirements: *id004
82
- - !ruby/object:Gem::Dependency
83
- name: rake
84
63
  prerelease: false
85
- requirement: &id005 !ruby/object:Gem::Requirement
86
- none: false
87
- requirements:
88
- - - ">="
89
- - !ruby/object:Gem::Version
90
- hash: 3
91
- segments:
92
- - 0
93
- version: "0"
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '1.3'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
94
76
  type: :development
95
- version_requirements: *id005
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
96
83
  description: Client for inspecting server state and reports it back to Fuey
97
- email:
84
+ email:
98
85
  - snyder2112@me.com
99
- executables:
86
+ executables:
100
87
  - fuey
101
88
  extensions: []
102
-
103
89
  extra_rdoc_files: []
104
-
105
- files:
90
+ files:
106
91
  - .gitignore
107
92
  - .rspec
108
93
  - .ruby-gemset
@@ -120,7 +105,9 @@ files:
120
105
  - lib/fuey_client/fuey/config.rb
121
106
  - lib/fuey_client/fuey/inspections.rb
122
107
  - lib/fuey_client/fuey/inspections/ping.rb
108
+ - lib/fuey_client/fuey/inspections/rfc_ping.rb
123
109
  - lib/fuey_client/fuey/inspections/snmp_walk.rb
110
+ - lib/fuey_client/fuey/inspections/support/sap.rb
124
111
  - lib/fuey_client/fuey/inspections/support/shell_command.rb
125
112
  - lib/fuey_client/fuey/log.rb
126
113
  - lib/fuey_client/fuey/model_initializer.rb
@@ -129,50 +116,44 @@ files:
129
116
  - spec/fuey_client/fuey/#trace_spec.rb#
130
117
  - spec/fuey_client/fuey/client_spec.rb
131
118
  - spec/fuey_client/fuey/inspections/ping_spec.rb
119
+ - spec/fuey_client/fuey/inspections/rfc_ping_spec.rb
132
120
  - spec/fuey_client/fuey/inspections/snmpwalk_spec.rb
133
121
  - spec/fuey_client/fuey/trace_spec.rb
122
+ - spec/matchers/inspection_shared_examples.rb
134
123
  - spec/spec_helper.rb
135
124
  - vendor/gems/b2b2dot0-sapnwrfc-0.26-x86_64-darwin-12.gem
136
125
  homepage: http://github.com/b2b2dot0/fuey_client
137
- licenses:
126
+ licenses:
138
127
  - MIT
139
128
  - GPL-2
129
+ metadata: {}
140
130
  post_install_message:
141
131
  rdoc_options: []
142
-
143
- require_paths:
132
+ require_paths:
144
133
  - lib
145
- required_ruby_version: !ruby/object:Gem::Requirement
146
- none: false
147
- requirements:
148
- - - ">="
149
- - !ruby/object:Gem::Version
150
- hash: 57
151
- segments:
152
- - 1
153
- - 8
154
- - 7
134
+ required_ruby_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '>='
137
+ - !ruby/object:Gem::Version
155
138
  version: 1.8.7
156
- required_rubygems_version: !ruby/object:Gem::Requirement
157
- none: false
158
- requirements:
159
- - - ">="
160
- - !ruby/object:Gem::Version
161
- hash: 3
162
- segments:
163
- - 0
164
- version: "0"
139
+ required_rubygems_version: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - '>='
142
+ - !ruby/object:Gem::Version
143
+ version: '0'
165
144
  requirements: []
166
-
167
145
  rubyforge_project:
168
- rubygems_version: 1.8.25
146
+ rubygems_version: 2.0.6
169
147
  signing_key:
170
- specification_version: 3
171
- summary: Client for inspecting server state and reports it back to Fuey. Requires the Fuey web app to have any value.
172
- test_files:
148
+ specification_version: 4
149
+ summary: Client for inspecting server state and reports it back to Fuey. Requires
150
+ the Fuey web app to have any value.
151
+ test_files:
173
152
  - spec/fuey_client/fuey/#trace_spec.rb#
174
153
  - spec/fuey_client/fuey/client_spec.rb
175
154
  - spec/fuey_client/fuey/inspections/ping_spec.rb
155
+ - spec/fuey_client/fuey/inspections/rfc_ping_spec.rb
176
156
  - spec/fuey_client/fuey/inspections/snmpwalk_spec.rb
177
157
  - spec/fuey_client/fuey/trace_spec.rb
158
+ - spec/matchers/inspection_shared_examples.rb
178
159
  - spec/spec_helper.rb