rbeapi 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. data/.gitignore +5 -0
  2. data/.rubocop.yml +21 -0
  3. data/CHANGELOG.md +24 -0
  4. data/Gemfile +3 -1
  5. data/Guardfile +3 -3
  6. data/README.md +92 -17
  7. data/Rakefile +99 -4
  8. data/gems/README.rst +4 -0
  9. data/gems/inifile/.gitignore +2 -0
  10. data/gems/inifile/README.rst +5 -0
  11. data/gems/inifile/inifile.spec.tmpl +84 -0
  12. data/gems/net_http_unix/.gitignore +2 -0
  13. data/gems/net_http_unix/README.rst +5 -0
  14. data/gems/net_http_unix/net_http_unix.spec.tmpl +54 -0
  15. data/gems/netaddr/README.rst +5 -0
  16. data/gems/netaddr/netaddr.spec.tmpl +50 -0
  17. data/lib/rbeapi/api/aaa.rb +14 -17
  18. data/lib/rbeapi/api/acl.rb +276 -0
  19. data/lib/rbeapi/api/dns.rb +7 -4
  20. data/lib/rbeapi/api/interfaces.rb +239 -239
  21. data/lib/rbeapi/api/ipinterfaces.rb +5 -3
  22. data/lib/rbeapi/api/logging.rb +8 -5
  23. data/lib/rbeapi/api/mlag.rb +45 -127
  24. data/lib/rbeapi/api/ntp.rb +1 -4
  25. data/lib/rbeapi/api/ospf.rb +16 -13
  26. data/lib/rbeapi/api/prefixlists.rb +4 -4
  27. data/lib/rbeapi/api/radius.rb +34 -25
  28. data/lib/rbeapi/api/routemaps.rb +16 -10
  29. data/lib/rbeapi/api/snmp.rb +26 -13
  30. data/lib/rbeapi/api/staticroutes.rb +6 -5
  31. data/lib/rbeapi/api/stp.rb +77 -18
  32. data/lib/rbeapi/api/switchports.rb +20 -12
  33. data/lib/rbeapi/api/system.rb +6 -6
  34. data/lib/rbeapi/api/tacacs.rb +9 -6
  35. data/lib/rbeapi/api/varp.rb +15 -10
  36. data/lib/rbeapi/api/vlans.rb +5 -6
  37. data/lib/rbeapi/api.rb +56 -16
  38. data/lib/rbeapi/client.rb +85 -50
  39. data/lib/rbeapi/eapilib.rb +95 -56
  40. data/lib/rbeapi/netdev/snmp.rb +7 -16
  41. data/lib/rbeapi/utils.rb +3 -5
  42. data/lib/rbeapi/version.rb +1 -1
  43. data/rbeapi.gemspec +4 -2
  44. data/rbeapi.spec.tmpl +72 -0
  45. data/spec/support/fixtures.rb +6 -4
  46. data/spec/support/shared_examples_for_api_modules.rb +3 -18
  47. data/spec/system/api_acl_spec.rb +128 -0
  48. data/spec/system/api_ospf_interfaces_spec.rb +17 -14
  49. data/spec/system/api_ospf_spec.rb +8 -8
  50. data/spec/system/api_varp_interfaces_spec.rb +22 -13
  51. data/spec/system/api_varp_spec.rb +1 -4
  52. data/spec/system/rbeapi/api/interfaces_base_spec.rb +3 -4
  53. data/spec/system/rbeapi/api/interfaces_ethernet_spec.rb +13 -9
  54. data/spec/system/rbeapi/api/interfaces_portchannel_spec.rb +43 -26
  55. data/spec/system/rbeapi/api/interfaces_vxlan_spec.rb +7 -6
  56. data/spec/system/rbeapi/api/ipinterfaces_spec.rb +34 -21
  57. data/spec/system/rbeapi/api/mlag_interfaces_spec.rb +15 -38
  58. data/spec/system/rbeapi/api/mlag_spec.rb +26 -30
  59. data/spec/system/rbeapi/api/snmp_spec.rb +0 -3
  60. data/spec/system/rbeapi/api/stp_instances_spec.rb +20 -12
  61. data/spec/system/rbeapi/api/stp_interfaces_spec.rb +1 -3
  62. data/spec/system/rbeapi/api/switchports_spec.rb +14 -12
  63. data/spec/system/rbeapi/api/system_spec.rb +0 -3
  64. data/spec/system/rbeapi/api/vlans_spec.rb +19 -9
  65. data/spec/unit/rbeapi/api/acl/default_spec.rb +158 -0
  66. data/spec/unit/rbeapi/api/acl/fixture_acl_standard.text +22 -0
  67. data/spec/unit/rbeapi/api/interfaces/base_spec.rb +123 -0
  68. data/spec/unit/rbeapi/api/interfaces/ethernet_spec.rb +89 -0
  69. data/spec/unit/rbeapi/api/interfaces/fixture_interfaces.text +219 -0
  70. data/spec/unit/rbeapi/api/interfaces/portchannel_spec.rb +149 -0
  71. data/spec/unit/rbeapi/api/interfaces/vxlan_spec.rb +243 -0
  72. data/spec/unit/rbeapi/api/mlag/default_spec.rb +218 -0
  73. data/spec/unit/rbeapi/api/mlag/fixture_mlag.text +238 -0
  74. data/spec/unit/rbeapi/api/vlans/default_spec.rb +135 -0
  75. data/spec/unit/rbeapi/api/vlans/fixture_vlans.text +5 -0
  76. metadata +79 -4
  77. data/lib/rbeapi/api/radius.rb.old +0 -399
data/.gitignore CHANGED
@@ -33,3 +33,8 @@ Gemfile.lock
33
33
 
34
34
  # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
35
35
  .rvmrc
36
+
37
+ # RPM stuff
38
+ rpmbuild
39
+ rpms
40
+ *.spec
data/.rubocop.yml ADDED
@@ -0,0 +1,21 @@
1
+ AllCops:
2
+ Exclude:
3
+ - '**/*.gemspec'
4
+
5
+ Metrics/CyclomaticComplexity:
6
+ Max: 20
7
+
8
+ Metrics/MethodLength:
9
+ Max: 20
10
+
11
+ Style/AccessorMethodName:
12
+ Enabled: False
13
+
14
+ Metrics/PerceivedComplexity:
15
+ Max: 20
16
+
17
+ Metrics/AbcSize:
18
+ Max: 50
19
+
20
+ Metrics/ClassLength:
21
+ Max: 130
data/CHANGELOG.md ADDED
@@ -0,0 +1,24 @@
1
+ Ruby Client for eAPI
2
+ ====================
3
+
4
+ ## v0.2.0, July, 2015
5
+
6
+ - Change the default transport to https
7
+ - Add new dependency: rubygem-netaddr
8
+ - Add [api.acl] with support for standard ACLs
9
+ - Add capability to build all necessary RPMS for EOS from the Rakefile
10
+ - Add `[connection:*]` syntax to eapi.conf to provide defaults for unspecified hosts
11
+ - Add configurable read and open timeouts
12
+ - Add new methods to the Entity class
13
+ - Add new VNI mapping to VxLan interface
14
+ - Add port-fast support to [api.stp]
15
+ - Fix issue with sending calls to interface instance by name
16
+ - Fix [api.vlans] issue parsing vlan name with a `-` character
17
+ - Fix issue where [api.interfaces] could return duplicate port-channel members on MLAG interfaces
18
+ - Fix missing OpenSSL require
19
+ - Fix Rubocop warnings
20
+
21
+
22
+ ## v0.1.0, 2/25/2015
23
+
24
+ - Initial public release of rbeapi
data/Gemfile CHANGED
@@ -1,7 +1,9 @@
1
1
  source ENV['GEM_SOURCE'] || 'https://rubygems.org'
2
2
 
3
- gem 'net_http_unix'
4
3
  gem 'inifile'
4
+ gem 'json'
5
+ gem 'net_http_unix'
6
+ gem 'netaddr'
5
7
 
6
8
  group :development do
7
9
  gem 'guard'
data/Guardfile CHANGED
@@ -4,12 +4,12 @@
4
4
  # More info at https://github.com/guard/guard#readme
5
5
 
6
6
  guard :rspec, cmd: 'bundle exec rspec' do
7
- watch(/^spec\/.+_spec\.rb$/)
8
- watch(/^lib\/(.+)\.rb$/) { |m| "spec/unit/#{m[1]}_spec.rb" }
7
+ watch(%r{^spec\/.+_spec\.rb$})
8
+ watch(%r{^lib\/(.+)\.rb$}) { |m| "spec/unit/#{m[1]}_spec.rb" }
9
9
  watch('spec/spec_helper.rb') { 'spec' }
10
10
  end
11
11
 
12
12
  guard :rubocop do
13
13
  watch(/.+\.rb$/)
14
- watch(/(?:.+\/)?\.rubocop\.yml$/) { |m| File.dirname(m[0]) }
14
+ watch(%r{(?:.+\/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
15
15
  end
data/README.md CHANGED
@@ -5,12 +5,18 @@
5
5
  1. [Overview] (#overview)
6
6
  * [Requirements] (#requirements)
7
7
  2. [Getting Started] (#getting-started)
8
+ * [Example eapi.conf File] (#example-eapiconf-file)
9
+ * [Using rbeapi] (#using-rbeapi)
8
10
  3. [Installation] (#installation)
11
+ 4. [Upgrading] (#upgrading)
9
12
  5. [Contributing] (#contributing)
10
- 6. [License] (#license)
13
+ 6. [Testing] (#testing)
14
+ 7. [License] (#license)
11
15
 
12
16
 
13
- The Ruby Cliet for eAPI provides a native Ruby implementation for programming Arista EOS network devices using Ruby. The Ruby client provides the ability to build native applications in Ruby that can communicate with EOS either locally via Unix domain sockets (on-box) or remotely over a HTTP/S transport (off-box). It uses a standard INI-style configuration file to specifiy one or more connection profiles.
17
+ # Overview
18
+
19
+ The Ruby Client for eAPI provides a native Ruby implementation for programming Arista EOS network devices using Ruby. The Ruby client provides the ability to build native applications in Ruby that can communicate with EOS either locally via Unix domain sockets (on-box) or remotely over a HTTP/S transport (off-box). It uses a standard INI-style configuration file to specifiy one or more connection profiles.
14
20
 
15
21
  The rbeapi implemenation also provides an API layer for building native Ruby objects that allow for configuration and state extraction of EOS nodes. The API layer provides a consistent implementation for working with EOS configuration resources. The implementation of the API layer is highly extensible and can be used as a foundation for building custom data models.
16
22
 
@@ -59,6 +65,12 @@ using the following values:
59
65
  * transport: https, deafult port: 443
60
66
  * transport: https_local, default port: 8080
61
67
  * transport: socket, default port: n/a
68
+ * **open_timeout** - The default number of seconds to wait for the eAPI
69
+ connection to open. Any number may be used, including Floats for fractional
70
+ seconds. Default value is 10 seconds.
71
+ * **read_timeout** - The default number of seconds to wait for one block of
72
+ eAPI results to be read (via one read(2) call). Any number may be used,
73
+ including Floats for fractional seconds. Default value is 10 seconds.
62
74
 
63
75
 
64
76
  _Note:_ See the EOS User Manual found at arista.com for more details on
@@ -119,10 +131,10 @@ using rbeapi. For more examples, please see the examples folder.
119
131
  require 'rbeapi/client'
120
132
 
121
133
  # create a node object by specifying the node to work with
122
- node = Rbeap::Client.connect_to('veos01')
134
+ node = Rbeapi::Client.connect_to('veos01')
123
135
 
124
136
  # send one or more commands to the node
125
- node.eanble('show hostname')
137
+ node.enable('show hostname')
126
138
  node.enable('show hostname')
127
139
  => [{:command=>"show hostname", :result=>{"fqdn"=>"veos01.arista.com", "hostname"=>"veos01"}, :encoding=>"json"}]
128
140
 
@@ -130,13 +142,13 @@ node.enable('show hostname')
130
142
  node.config('hostname veos01')
131
143
  => [{}]
132
144
 
133
- # multiple commands can be sent by using a list (works for both enable or
134
- config)
145
+ # multiple commands can be sent by using a list (works for both enable or config)
146
+
135
147
  node.config(['interface Ethernet1', 'description foo'])
136
148
  => [{}, {}]
137
149
 
138
- # return the running or startup configuration from the node (output omitted for
139
- brevity)
150
+ # return the running or startup configuration from the node (output omitted for brevity)
151
+
140
152
  node.running_config
141
153
 
142
154
  node.startup_config
@@ -185,13 +197,80 @@ folder. See the examples folder for additional examples.
185
197
  The source code for rbeapi is provided on Github at
186
198
  http://github.com/arista-eosplus/rbeapi. All current development is done in
187
199
  the develop branch. Stable released versions are tagged in the master branch
188
- and uploaded to RubyGems.
200
+ and uploaded to [RubyGems](https://rubygems.org/).
189
201
 
190
- * To install the latest stable version of rbeapi, simply run ``gem install
191
- rbeapi``
202
+ * To install the latest stable version of rbeapi, simply run ``gem install rbeapi``
192
203
  * To install the latest development version from Github, simply clone the
193
- develop branch and run ``rake build``
194
-
204
+ develop branch and run
205
+
206
+ ```
207
+ $ rake build
208
+ $ rake install
209
+ ```
210
+
211
+ * To create an RPM, run ``rake rpm``
212
+ * To generate a SWIX file for EOS with necessary dependencies, run
213
+ ``rake all_rpms`` then follow the ``swix create`` instructions, provided
214
+ by the build. NOTE:
215
+ [PuppetLabs](https://puppetlabs.com/misc/pe-files) provides a puppet agent SWIX which includes Ruby 1.9.3 in
216
+ /opt/puppet/bin/ which is different from where you might otherwise install
217
+ Ruby. If you have installed the puppet-enterprise SWIX, then you should
218
+ build and use the ``pe-rbeapi`` swix, below. Otherwise, if you have installed
219
+ Ruby 1.9.3 in the standard system location, then the ``rbeapi`` SWIX may be
220
+ used.
221
+
222
+ ```
223
+ $ bundle install --path .bundle/gems/
224
+ $ bundle exec rake all_rpms
225
+ ...
226
+ RPMs are available in rpms/noarch/
227
+ Copy the RPMs to an EOS device then run the 'swix create' command.
228
+ Examples:
229
+ Puppet Open Source:
230
+ cd /mnt/flash; swix create rbeapi-0.2.0-1.swix \
231
+ rubygem-rbeapi-0.2.0-1.eos4.noarch.rpm \
232
+ rubygem-inifile-3.0.0-2.eos4.noarch.rpm \
233
+ rubygem-netaddr-1.5.0-1.eos4.noarch.rpm \
234
+ rubygem-net_http_unix-0.2.1-2.eos4.noarch.rpm
235
+ Puppet-enterprise:
236
+ cd/mnt/flash; swix create pe-rbeapi-0.2.0-1.swix \
237
+ pe-rubygem-rbeapi-0.2.0-1.eos4.noarch.rpm \
238
+ pe-rubygem-inifile-3.0.0-2.eos4.noarch.rpm \
239
+ pe-rubygem-netaddr-1.5.0-1.eos4.noarch.rpm
240
+ ```
241
+
242
+ On EOS:
243
+ ```
244
+ Arista# copy <URI-to-RPMs> flash:
245
+ Arista# bash
246
+ -bash-4.1# cd /mnt/flash/
247
+ -bash-4.1# swix create pe-rbeapi-0.2.0-1.swix \
248
+ pe-rubygem-rbeapi-0.1.0-1.eos4.noarch.rpm \
249
+ pe-rubygem-inifile-3.0.0-1.eos4.noarch.rpm \
250
+ pe-rubygem-netaddr-1.5.0-1.eos4.noarch.rpm
251
+ -bash-4.1# exit
252
+ Arista# copy flash:pe-rbeapi-0.2.0-1.swix extension:
253
+ Arista# extension pe-rbeapi-0.2.0-1.swix
254
+ Arista# copy installed-extensions boot-extensions
255
+ ```
256
+
257
+ # Upgrading
258
+
259
+ On EOS:
260
+ ```
261
+ Arista# no extension pe-rbeapi-0.1.0-2.swix
262
+ Arista# extension pe-rbeapi-0.2.0-1.swix
263
+ Arista# copy installed-extensions boot-extensions
264
+ ```
265
+
266
+ # Testing
267
+
268
+ The rbeapi library provides spec tests. To run the spec tests, you will need to
269
+ update the ``dut.conf`` file found in spec/fixtures. The switch used for testing
270
+ should have at least interfaces Ethernet1-7.
271
+
272
+ * To run the spec tests, run ``bundle exec rspec spec`` from the root of the
273
+ rbeapi source folder.
195
274
 
196
275
  # Contributing
197
276
 
@@ -212,7 +291,3 @@ Redistributions in binary form must reproduce the above copyright notice, this l
212
291
  Neither the name of Arista Networks nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
213
292
 
214
293
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ARISTA NETWORKS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
215
-
216
-
217
-
218
-
data/Rakefile CHANGED
@@ -1,12 +1,107 @@
1
1
  require 'bundler/gem_tasks'
2
2
 
3
- $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
4
4
  require 'rbeapi/version'
5
5
 
6
6
  task :build do
7
- system "gem build rbeapi.gemspec"
7
+ system 'gem build rbeapi.gemspec'
8
8
  end
9
9
 
10
- task :release => :build do
11
- system "gem push rbeapi-#{Rbeapi::VERSION}"
10
+ RPM_OPTS = '--define "_topdir %(pwd)/rpmbuild" --define "_builddir ' \
11
+ '%{_topdir}" --define "_rpmdir %(pwd)/rpms" --define "_srcrpmdir ' \
12
+ '%{_rpmdir}" --define "_sourcedir %(pwd)" --define "_specdir %(pwd)" -bb'
13
+ desc 'Generate regular and puppet-enterprise rbeapi RPMs for EOS'
14
+ task rpm: :build do
15
+ system "sed -e 's/^Version:.*/Version: #{Rbeapi::VERSION}/g' " \
16
+ 'rbeapi.spec.tmpl > rbeapi.spec'
17
+ system "rpmbuild #{RPM_OPTS} rbeapi.spec"
18
+ system "rpmbuild #{RPM_OPTS} --define 'enterprise 1' rbeapi.spec"
19
+ RPMS = `find rpms/noarch -name "*rbeapi*rpm"`
20
+ puts "\n################################################\n#"
21
+ puts "Created the following in rpms/noarch/\n#{RPMS}"
22
+ puts "#\n################################################\n\n"
23
+ end
24
+
25
+ desc 'Package the inifile gem in to regular and puppet-enterprise RPMs for EOS'
26
+ task :inifile do
27
+ # Get the latest version info
28
+ INIFILE_VERSION = `wget -q --output-document=- \
29
+ https://rubygems.org/gems/inifile/versions.atom | \
30
+ awk '/title>inifile/ {match($2, \"[0-9.]+\", a); print a[0]; exit}'`.strip
31
+ system "gem fetch inifile --version '=#{INIFILE_VERSION}'"
32
+ puts "Building rpm for inifile (#{INIFILE_VERSION})"
33
+ system "sed -e 's/^Version:.*/Version: #{INIFILE_VERSION}/g' " \
34
+ 'gems/inifile/inifile.spec.tmpl > gems/inifile/inifile.spec'
35
+ system "rpmbuild #{RPM_OPTS} gems/inifile/inifile.spec"
36
+ system "rpmbuild #{RPM_OPTS} --define 'enterprise 1' " \
37
+ 'gems/inifile/inifile.spec'
38
+ RPMS = `find rpms/noarch -name "*inifile*rpm"`
39
+ puts "\n################################################\n#"
40
+ puts "Created the following in rpms/noarch/\n#{RPMS}"
41
+ puts "#\n################################################\n\n"
42
+ end
43
+
44
+ desc 'Package the net_http_unix gem in to an RPM for EOS'
45
+ task :net_http_unix do
46
+ # Get the latest version info
47
+ NET_HTTP_VERSION = `wget -q --output-document=- \
48
+ https://rubygems.org/gems/net_http_unix/versions.atom | awk \
49
+ '/title>net_http_unix/ {match($2, \"[0-9.]+\", a); print a[0]; exit}'`.strip
50
+ system "gem fetch net_http_unix --version '=#{NET_HTTP_VERSION}'"
51
+ puts "Building rpm for net_http_unix (#{NET_HTTP_VERSION})"
52
+ system "sed -e 's/^Version:.*/Version: #{NET_HTTP_VERSION}/g' " \
53
+ 'gems/net_http_unix/net_http_unix.spec.tmpl > ' \
54
+ 'gems/net_http_unix/net_http_unix.spec'
55
+ system "rpmbuild #{RPM_OPTS} gems/net_http_unix/net_http_unix.spec"
56
+ RPMS = `find rpms/noarch -name "*net_http_unix*rpm"`
57
+ puts "\n################################################\n#"
58
+ puts "Created the following in rpms/noarch/\n#{RPMS}"
59
+ puts "#\n################################################\n\n"
60
+ end
61
+
62
+ desc 'Package the netaddr gem in to regular and puppet-enterprise RPMs for EOS'
63
+ task :netaddr do
64
+ # Get the latest version info
65
+ NETADDR_VERSION = `wget -q --output-document=- \
66
+ https://rubygems.org/gems/netaddr/versions.atom | \
67
+ awk '/title>netaddr/ {match($2, \"[0-9.]+\", a); print a[0]; exit}'`.strip
68
+ system "gem fetch netaddr --version '=#{NETADDR_VERSION}'"
69
+ puts "Building rpm for netaddr (#{NETADDR_VERSION})"
70
+ system "sed -e 's/^Version:.*/Version: #{NETADDR_VERSION}/g' " \
71
+ 'gems/netaddr/netaddr.spec.tmpl > gems/netaddr/netaddr.spec'
72
+ system "rpmbuild #{RPM_OPTS} gems/netaddr/netaddr.spec"
73
+ system "rpmbuild #{RPM_OPTS} --define 'enterprise 1' " \
74
+ 'gems/netaddr/netaddr.spec'
75
+ RPMS = `find rpms/noarch -name "*netaddr*rpm"`
76
+ puts "\n################################################\n#"
77
+ puts "Created the following in rpms/noarch/\n#{RPMS}"
78
+ puts "#\n################################################\n\n"
79
+ end
80
+
81
+ desc 'Generate all RPM packages needed for an EOS SWIX'
82
+ task all_rpms: :build do
83
+ Rake::Task['rpm'].invoke
84
+ Rake::Task['inifile'].invoke
85
+ Rake::Task['net_http_unix'].invoke
86
+ Rake::Task['netaddr'].invoke
87
+ puts 'RPMs are available in rpms/noarch/'
88
+ puts "Copy the RPMs to an EOS device then run the 'swix create' command."
89
+ puts ' Examples: '
90
+ puts ' Puppet Open Source: '
91
+ puts ' cd /mnt/flash; \\'
92
+ puts " swix create rbeapi-#{Rbeapi::VERSION}-1.swix \\"
93
+ puts " rubygem-rbeapi-#{Rbeapi::VERSION}-1.eos4.noarch.rpm \\"
94
+ puts ' rubygem-inifile-3.0.0-2.eos4.noarch.rpm \\'
95
+ puts ' rubygem-netaddr-1.5.0-1.eos4.noarch.rpm \\'
96
+ puts ' rubygem-net_http_unix-0.2.1-2.eos4.noarch.rpm'
97
+ puts ' Puppet-enterprise: '
98
+ puts ' cd/mnt/flash; \\'
99
+ puts " swix create pe-rbeapi-#{Rbeapi::VERSION}-1.swix \\"
100
+ puts " pe-rubygem-rbeapi-#{Rbeapi::VERSION}-1.eos4.noarch.rpm \\"
101
+ puts ' pe-rubygem-inifile-3.0.0-2.eos4.noarch.rpm \\'
102
+ puts ' pe-rubygem-netaddr-1.5.0-1.eos4.noarch.rpm'
103
+ end
104
+
105
+ task release: :build do
106
+ system "gem push rbeapi-#{Rbeapi::VERSION}.gem"
12
107
  end
data/gems/README.rst ADDED
@@ -0,0 +1,4 @@
1
+ This directory includes subdirectories for rubygems required by rbeapi. The
2
+ packaging definitions, herein, are ONLY to be used when packaging for
3
+ Arista EOS. For all other platform, native platform packages or the
4
+ 'gem install' command should be used.
@@ -0,0 +1,2 @@
1
+ # ignore generated RPM .spec files
2
+ *.spec
@@ -0,0 +1,5 @@
1
+ This directory contains packaging information to create a basic RPM of
2
+ the inifile ruby gem for EOS. Due to thenature of EOS, certain shortcuts
3
+ were used instead of the more formal method:
4
+
5
+ gem2rpm --fetch inifile > inifile.spec
@@ -0,0 +1,84 @@
1
+ # -*- rpm-spec -*-
2
+ %global gem_name inifile
3
+
4
+ Name: %{?enterprise:pe-}rubygem-%{gem_name}
5
+ Version: 3.0.0
6
+ Release: 2.eos4
7
+ Summary: INI file reader and writer
8
+
9
+ Group: Development/Languages
10
+ License: Unknown
11
+ URL: http://rubygems.org/gems/inifile
12
+ Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
13
+
14
+ %if 0%{?enterprise:1} == 1
15
+ # Use these settings for Puppet Enterprise
16
+ %global gem /opt/puppet/bin/gem
17
+ Requires: pe-ruby
18
+ Requires: pe-rubygems
19
+ Provides: pe-rubygem(%{gem_name}) = %{version}
20
+ Provides: pe-rubygem-%{gem_name} = %{version}
21
+ %else
22
+ # Use these settings for all other installs
23
+ %global gem gem
24
+ Requires: ruby(abi) = %{rubyabi}
25
+ Provides: ruby(%{gem_name}) = %{version}-%{release}
26
+ %endif
27
+
28
+ BuildArch: noarch
29
+
30
+ %description
31
+ Although made popular by Windows, INI files can be used on any system thanks
32
+ to their flexibility. They allow a program to store configuration data, which
33
+ can then be easily parsed and changed. Two notable systems that use the INI
34
+ format are Samba and Trac.
35
+ More information about INI files can be found on the [Wikipedia
36
+ Page](http://en.wikipedia.org/wiki/INI_file).
37
+ ### Properties
38
+ The basic element contained in an INI file is the property. Every property has
39
+ a name and a value, delimited by an equals sign *=*. The name appears to the
40
+ left of the equals sign and the value to the right.
41
+ name=value
42
+ ### Sections
43
+ Section declarations start with *[* and end with *]* as in `[section1]` and
44
+ `[section2]` shown in the example below. The section declaration marks the
45
+ beginning of a section. All properties after the section declaration will be
46
+ associated with that section.
47
+ ### Comments
48
+ All lines beginning with a semicolon *;* or a number sign *#* are considered
49
+ to be comments. Comment lines are ignored when parsing INI files.
50
+ ### Example File Format
51
+ A typical INI file might look like this:
52
+ [section1]
53
+ ; some comment on section1
54
+ var1 = foo
55
+ var2 = doodle
56
+ var3 = multiline values \
57
+ are also possible
58
+ [section2]
59
+ # another comment
60
+ var1 = baz
61
+ var2 = shoodle.
62
+
63
+ %prep
64
+ %setup -q -D -T -n .
65
+
66
+ %install
67
+ mkdir -p %{buildroot}
68
+ install %{SOURCE0} %{buildroot}/
69
+
70
+ %files
71
+ /%{gem_name}-%{version}.gem
72
+
73
+ %post
74
+ %{gem} install --local /%{gem_name}-%{version}.gem > /dev/null 2>&1
75
+
76
+ %preun
77
+ %{gem} uninstall %{gem_name} --version '= %{version}' > /dev/null 2>&1
78
+
79
+ %changelog
80
+ * Thu May 21 2015 Jere Julian - 3.0.0-2
81
+ - Ubuntu requires we manually create the buildroot
82
+
83
+ * Tue Mar 17 2015 Jere Julian - 3.0.0-1
84
+ - Initial package loosely based off of gem2rpm output
@@ -0,0 +1,2 @@
1
+ # ignore generated RPM .spec files
2
+ *.spec
@@ -0,0 +1,5 @@
1
+ This directory contains packaging information to create a basic RPM of
2
+ the net_http_unix ruby gem for EOS. Due to thenature of EOS, certain shortcuts
3
+ were used instead of the more formal method:
4
+
5
+ gem2rpm --fetch net_http_unix > net_http_unix.spec
@@ -0,0 +1,54 @@
1
+ # -*- rpm-spec -*-
2
+ %global gem_name net_http_unix
3
+
4
+ Name: %{?enterprise:pe-}rubygem-%{gem_name}
5
+ Version: 0.2.1
6
+ Release: 2.eos4
7
+ Summary: Wrapper around Net::HTTP with AF_UNIX support
8
+
9
+ Group: Development/Languages
10
+ License: Apache 2.0
11
+ URL: http://github.com/puppetlabs/net_http_unix
12
+ Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
13
+
14
+ %if 0%{?enterprise:1} == 1
15
+ # Use these settings for Puppet Enterprise
16
+ %global gem /opt/puppet/bin/gem
17
+ Requires: pe-ruby
18
+ Requires: pe-rubygems
19
+ Provides: pe-rubygem(%{gem_name}) = %{version}
20
+ Provides: pe-rubygem-%{gem_name} = %{version}
21
+ %else
22
+ # Use these settings for all other installs
23
+ %global gem gem
24
+ Requires: ruby(abi) = %{rubyabi}
25
+ Provides: ruby(%{gem_name}) = %{version}-%{release}
26
+ %endif
27
+
28
+ BuildArch: noarch
29
+
30
+ %description
31
+ Wrapper around Net::HTTP with AF_UNIX support.
32
+
33
+ %prep
34
+ %setup -q -D -T -n .
35
+
36
+ %install
37
+ mkdir -p %{buildroot}
38
+ install %{SOURCE0} %{buildroot}/
39
+
40
+ %files
41
+ /%{gem_name}-%{version}.gem
42
+
43
+ %post
44
+ %{gem} install --local /%{gem_name}-%{version}.gem > /dev/null 2>&1
45
+
46
+ %preun
47
+ %{gem} uninstall %{gem_name} --version '= %{version}' > /dev/null 2>&1
48
+
49
+ %changelog
50
+ * Tue May 21 2015 Jere Julian - 0.2.1-2
51
+ - Ubuntu requires we manually create the buildroot
52
+
53
+ * Tue Mar 17 2015 Jere Julian - 0.2.1-1
54
+ - Initial package loosely based off of gem2rpm output
@@ -0,0 +1,5 @@
1
+ This directory contains packaging information to create a basic RPM of
2
+ the netaddr ruby gem for EOS. Due to thenature of EOS, certain shortcuts
3
+ were used instead of the more formal method:
4
+
5
+ gem2rpm --fetch netaddr > netaddr.spec.tmpl
@@ -0,0 +1,50 @@
1
+ # Generated from netaddr-1.5.0.gem by gem2rpm -*- rpm-spec -*-
2
+ %global gem_name netaddr
3
+
4
+ Name: %{?enterprise:pe-}rubygem-%{gem_name}
5
+ Version: 1.5.0
6
+ Release: 1.eos4
7
+ Summary: A package for manipulating network addresses
8
+ Group: Development/Languages
9
+ License: Unknown
10
+ Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
11
+
12
+ %if 0%{?enterprise:1} == 1
13
+ # Use these settings for Puppet Enterprise
14
+ %global gem /opt/puppet/bin/gem
15
+ Requires: pe-ruby
16
+ Requires: pe-rubygems
17
+ Provides: pe-rubygem(%{gem_name}) = %{version}
18
+ Provides: pe-rubygem-%{gem_name} = %{version}
19
+ %else
20
+ # Use these settings for all other installs
21
+ %global gem gem
22
+ Requires: ruby(abi) = %{rubyabi}
23
+ Provides: ruby(%{gem_name}) = %{version}-%{release}
24
+ %endif
25
+
26
+ BuildArch: noarch
27
+
28
+ %description
29
+ A package for manipulating network addresses.
30
+
31
+
32
+ %prep
33
+ %setup -q -D -T -n .
34
+
35
+ %install
36
+ mkdir -p %{buildroot}
37
+ install %{SOURCE0} %{buildroot}/
38
+
39
+ %files
40
+ /%{gem_name}-%{version}.gem
41
+
42
+ %post
43
+ %{gem} install --local /%{gem_name}-%{version}.gem > /dev/null 2>&1
44
+
45
+ %preun
46
+ %{gem} uninstall %{gem_name} --version '= %{version}' > /dev/null 2>&1
47
+
48
+ %changelog
49
+ * Tue Jul 07 2015 Jere Julian <jere@arista.com> - 1.5.0-1
50
+ - Initial package