net-netconf 0.4.2 → 0.4.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 741e277664fb1c1660b55878c50a47e0b4d21887
4
- data.tar.gz: 7b46a74d28874a65a1f346a9303b6e24744dcb61
3
+ metadata.gz: 53effcba8e5c743c307614f8844e07b1c811547d
4
+ data.tar.gz: e667da4cb15637e7d7af810a3a57790bc29257e8
5
5
  SHA512:
6
- metadata.gz: 058610c26844ee71ffbfa832f300af0e9bc08e66be87325f53ade81730e0ea8a1feed488c4556aea3bab6504ce25e9e155cab5dfad4d5c088c42e1148ecb6e1e
7
- data.tar.gz: ba146336a067d81baad536e725cf5c981ef1139c50ee78e5373458da9b1c1cd18cdc51a368eb15fefd620750282cb2bf596e561bfe5af800cabe6e3651e33737
6
+ metadata.gz: 4abcdb45b1284a982f92e84754b036a5ded782496ebffebb91dcbb5d559d3e50a8de354ec42f9e41044dddffb87ff23c251954d2febe3cdf2e780cee444ab24f
7
+ data.tar.gz: f3c2c7382f5cc0f02ebda694d07e05c86039191d0d1454bd51062f1133e865b3f4ee1b457aa81075099773d4f5b6c4b3f6d171571444afbf30daf3fc5f98e7c3
@@ -6,7 +6,7 @@ module Netconf
6
6
  module Junos
7
7
  module IOProc
8
8
  def trans_open
9
- @trans = IO.popen( "xml-mode netconf need-trailer", "r+")
9
+ @trans = IO.popen('xml-mode netconf need-trailer', 'r+')
10
10
  self
11
11
  end
12
12
  end
@@ -5,26 +5,24 @@
5
5
  # JUNIPER PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6
6
 
7
7
  module Netconf
8
-
9
8
  class JunosConfig
10
-
11
- DELETE = { :delete => 'delete' }
12
- REPLACE = { :replace => 'replace' }
9
+ DELETE = { delete: 'delete' }
10
+ REPLACE = { replace: 'replace' }
13
11
 
14
12
  attr_reader :doc
15
13
  attr_reader :collection
16
14
 
17
- def initialize( options )
18
- @doc_ele = "configuration"
15
+ def initialize(options)
16
+ @doc_ele = 'configuration'
19
17
 
20
18
  if options == :TOP
21
- @doc = Nokogiri::XML("<#{@doc_ele}/>")
19
+ @doc = Nokogiri::XML('<#{@doc_ele}/>')
22
20
  return
23
21
  end
24
22
 
25
23
  unless options[:TOP].nil?
26
24
  @doc_ele = options[:TOP]
27
- @doc = Nokogiri::XML("<#{@doc_ele}/>")
25
+ @doc = Nokogiri::XML('<#{@doc_ele}/>')
28
26
  return
29
27
  end
30
28
 
@@ -37,27 +35,27 @@ module Netconf
37
35
  end
38
36
  end
39
37
 
40
- def <<( obj )
38
+ def <<(obj)
41
39
  if defined? @collection
42
40
  @collection[obj[:name]] = obj
43
41
  elsif defined? @doc
44
- obj.build_xml( @doc )
42
+ obj.build_xml(@doc)
45
43
  else
46
44
  # TBD:error
47
45
  end
48
46
  end
49
47
 
50
- def build_xml( ng_xml, &block )
51
- at_ele = ng_xml.at( @edit_path )
48
+ def build_xml(ng_xml, &block)
49
+ at_ele = ng_xml.at(@edit_path)
52
50
  if at_ele.nil?
53
51
  # no xpath anchor point, so we need to create it
54
- at_ele = edit_path( ng_xml, @edit_path )
52
+ at_ele = edit_path(ng_xml, @edit_path)
55
53
  end
56
54
  build_proc = (block_given?) ? block : @to_xml
57
55
 
58
- @collection.each do |k,v|
59
- with( at_ele ) do |e|
60
- build_proc.call( e, v )
56
+ @collection.each do |_k, v|
57
+ with(at_ele) do |e|
58
+ build_proc.call(e, v)
61
59
  end
62
60
  end
63
61
  end
@@ -68,7 +66,7 @@ module Netconf
68
66
  # the user enter it all the time
69
67
 
70
68
  cfg_xpath = xpath
71
- dot = ng_xml.at( cfg_xpath )
69
+ dot = ng_xml.at(cfg_xpath)
72
70
  return dot if dot
73
71
 
74
72
  # we need to determine how much of the xpath
@@ -78,7 +76,7 @@ module Netconf
78
76
 
79
77
  xpath_a = cfg_xpath.split('/')
80
78
  need_a = []
81
- until xpath_a.empty? or dot
79
+ until xpath_a.empty? || dot
82
80
  need_a.unshift xpath_a.pop
83
81
  check_xpath = xpath_a.join('/')
84
82
  dot = ng_xml.at( check_xpath )
@@ -90,15 +88,15 @@ module Netconf
90
88
 
91
89
  dot = ng_xml.at(xpath_a.join('/'))
92
90
  need_a.each do |ele|
93
- dot = dot.add_child( Nokogiri::XML::Node.new( ele, ng_xml ))
91
+ dot = dot.add_child(Nokogiri::XML::Node.new(ele, ng_xml))
94
92
  end
95
- return dot
93
+
94
+ dot
96
95
  end
97
96
 
98
- def with( ng_xml, &block )
99
- Nokogiri::XML::Builder.with( ng_xml, &block )
97
+ def with(ng_xml, &block)
98
+ Nokogiri::XML::Builder.with(ng_xml, &block)
100
99
  end
101
100
  end
102
- #-- class end
101
+ #-- class end
103
102
  end
104
-
@@ -156,6 +156,7 @@ module Netconf
156
156
  end
157
157
  @trans.rpc_exec(rpc_nx)
158
158
  end
159
- end # module: JUNOS
160
- end # module: RPC
161
- end # module: Netconf
159
+ end # module: JUNOS
160
+ end # module: RPC
161
+ end # module: Netconf
162
+ end
@@ -1,3 +1,3 @@
1
1
  module Netconf
2
- VERSION = '0.4.2'
2
+ VERSION = '0.4.3'
3
3
  end
metadata CHANGED
@@ -1,10 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-netconf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Kirsche
8
+ - Jeremy Schulman
9
+ - Ankit Jain
8
10
  autorequire:
9
11
  bindir: bin
10
12
  cert_chain: []