junos-ez-stdlib 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # 2013-April
2
+
3
+ - 0.0.10: 2013-04-29
4
+
5
+ Initial release of code into RubyGems. Code tested on EX and SRX-branch. Consider this code
6
+ as "early-adopter". Comments/feedback is welcome and appreciated.
7
+
8
+ - 0.0.11: 2013-04-29
9
+
10
+ Updated Junos::Ez::RE::Utils. #memory changed :procs from Hash to Array. #users changed return from Hash to Array
11
+
@@ -11,5 +11,5 @@ Gem::Specification.new do |s|
11
11
  s.authors = ["Jeremy Schulman"]
12
12
  s.email = 'jschulman@juniper.net'
13
13
  s.files = FileList[ '*', 'lib/**/*.rb', 'examples/**/*.rb', 'docs/**/*.md' ]
14
- s.add_dependency('netconf')
14
+ s.add_dependency('netconf', ">= 0.2.5")
15
15
  end
@@ -9,7 +9,7 @@ module Junos; end
9
9
 
10
10
  module Junos::Ez
11
11
 
12
- VERSION = "0.0.10"
12
+ VERSION = "0.0.11"
13
13
 
14
14
  ### ---------------------------------------------------------------
15
15
  ### rpc_errors - decodes the XML into an array of error/Hash
@@ -163,18 +163,19 @@ class Junos::Ez::RE::Provider < Junos::Ez::Provider::Parent
163
163
 
164
164
  def users
165
165
  got = @ndev.rpc.get_system_users_information
166
- users_h = {}
166
+ users_a = []
167
167
  got.xpath('uptime-information/user-table/user-entry').each do |user|
168
168
  user_h = {}
169
- user_name = user.xpath('user').text.strip
169
+ users_a << user_h
170
+
171
+ user_h[:name] = user.xpath('user').text.strip
170
172
  user_h[:tty] = user.xpath('tty').text.strip
171
173
  user_h[:from] = user.xpath('from').text.strip
172
174
  user_h[:login_time] = user.xpath('login-time').text.strip
173
175
  user_h[:idle_time] = user.xpath('idel-time').text.strip
174
176
  user_h[:command] = user.xpath('command').text.strip
175
- users_h[user_name] = user_h
176
177
  end
177
- users_h
178
+ users_a
178
179
  end
179
180
 
180
181
  ### ---------------------------------------------------------------
@@ -348,18 +349,22 @@ class Junos::Ez::RE::Provider
348
349
  }
349
350
  }
350
351
 
351
- as_h[:procs] = {}
352
+ # create an Array of process information. The process-names are
353
+ # not guaranteed to be unique, so do this as an Array vs. Hash
354
+
355
+ as_h[:procs] = []
352
356
  as_xml.xpath('pmap-terse-information/pmap-terse-summary').each do |proc|
353
357
  proc_h = {}
354
- proc_name = proc.xpath('map-name | process-name').text.strip
355
- as_h[:procs][proc_name] = proc_h
358
+ as_h[:procs] << proc_h
356
359
 
360
+ proc_h[:name] = proc.xpath('map-name | process-name').text.strip
357
361
  proc_h[:pid] = proc.xpath('pid').text.to_i
358
362
  proc_h[:size] = proc.xpath('size').text.to_i
359
363
  proc_h[:size_pct] = proc.xpath('size-percent').text.to_f
360
364
  proc_h[:resident] = proc.xpath('resident').text.to_i
361
365
  proc_h[:resident_pct] = proc.xpath('resident-percent').text.to_f
362
- end
366
+ end
367
+
363
368
  end
364
369
 
365
370
  def _alarm_info_to_h( alarm, alarm_h )
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: junos-ez-stdlib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: 0.2.5
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,13 +26,14 @@ dependencies:
26
26
  requirements:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
- version: '0'
29
+ version: 0.2.5
30
30
  description: ! 'Automation Framework for Junos/NETCONF: Facts, Providers, and Utils'
31
31
  email: jschulman@juniper.net
32
32
  executables: []
33
33
  extensions: []
34
34
  extra_rdoc_files: []
35
35
  files:
36
+ - CHANGELOG.md
36
37
  - junos-ez-stdlib.gemspec
37
38
  - LICENSE
38
39
  - README.md