Skip to content

Commit

Permalink
Merge pull request #81 from arista-eosplus/develop
Browse files Browse the repository at this point in the history
Merge develop to master for Release 0.4.0
  • Loading branch information
jerearista committed Nov 21, 2015
2 parents cdc3ff1 + 990aa4d commit 3ca991f
Show file tree
Hide file tree
Showing 38 changed files with 4,436 additions and 254 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
Ruby Client for eAPI
====================

## v0.4.0, November, 2015

- New users API
- New routemap API
- New vrrp API
- BGP API: Add support for maximum_paths and maximum_ecmp_paths
- System API: add support for managing the global EOS ‘ip routing’ setting
- Updated RPM/SWIX packaging to handle Puppet All-In-One (AIO) agent paths
New package names are: rbeapi, rbeapi-puppet3 (formerly pe-puppet),
and rbeapi-puppet-aio
- Fixed port-channel get_members() issue with EOS 4.15 and above.
- Fixed issue with the eapi.conf wildcard connection
- Fixed issue that would cause a traceback when searching for eapi.conf if
$HOME was not set


## v0.3.0, August, 2015

- API Change: Eliminated overloading the value option in command_builder. When
Expand Down
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ gem 'net_http_unix'
gem 'netaddr'

group :development do
gem 'rubocop', '>=0.35.1'
gem 'guard'
gem 'guard-rspec'
gem 'guard-rubocop'
gem 'guard-shell'
end

group :development, :test do
gem 'listen', '<=3.0.3'
gem 'rake', '~> 10.1.0'
gem 'rspec', '~> 3.0.0'
gem 'rspec-mocks', '~> 3.0.0'
Expand All @@ -22,7 +24,7 @@ group :development, :test do
gem 'pry', require: false
gem 'pry-doc', require: false
gem 'pry-stack_explorer', require: false
gem 'rbeapi', '0.3.0', path: '.'
gem 'rbeapi', '0.4.0', path: '.'
gem 'ci_reporter_rspec', require: false
gem 'simplecov-json', require: false
gem 'simplecov-rcov', require: false
Expand Down
4 changes: 2 additions & 2 deletions Guardfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

guard :rspec, cmd: 'bundle exec rspec' do
watch(%r{^spec\/.+_spec\.rb$})
watch(%r{^lib\/(.+)\.rb$}) { |m| "spec/unit/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { 'spec' }
watch(%r{^lib\/(.+)\.rb$}) { |m| "spec/unit/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { 'spec' }
end

guard :rubocop do
Expand Down
59 changes: 35 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,52 +214,63 @@ and uploaded to [RubyGems](https://rubygems.org/).
by the build. NOTE:
[PuppetLabs](https://puppetlabs.com/misc/pe-files) provides a puppet agent SWIX which includes Ruby 1.9.3 in
/opt/puppet/bin/ which is different from where you might otherwise install
Ruby. If you have installed the puppet-enterprise SWIX, then you should
build and use the ``pe-rbeapi`` swix, below. Otherwise, if you have installed
Ruby. If you have installed the puppet-enterprise 3.x SWIX, then you should
build and use the ``rbeapi-puppet3`` swix, below. If you have installed
the puppet-enterprise 2015.x SWIX, then you should build and use the
``rbeapi-puppet-aio`` swix, below. Otherwise, if you have installed at least
Ruby 1.9.3 in the standard system location, then the ``rbeapi`` SWIX may be
used.

```
$ bundle install --path .bundle/gems/
$ bundle exec rake all_rpms
...
RPMs are available in rpms/noarch/
Copy the RPMs to an EOS device then run the 'swix create' command.
Examples:
Puppet Open Source:
cd /mnt/flash; swix create rbeapi-0.3.0-1.swix \
rubygem-rbeapi-0.3.0-1.eos4.noarch.rpm \
rubygem-inifile-3.0.0-2.eos4.noarch.rpm \
rubygem-netaddr-1.5.0-1.eos4.noarch.rpm \
rubygem-net_http_unix-0.2.1-2.eos4.noarch.rpm
Puppet-enterprise:
cd/mnt/flash; swix create pe-rbeapi-0.3.0-1.swix \
pe-rubygem-rbeapi-0.3.0-1.eos4.noarch.rpm \
pe-rubygem-inifile-3.0.0-2.eos4.noarch.rpm \
pe-rubygem-netaddr-1.5.0-1.eos4.noarch.rpm
RPMs are available in rpms/noarch/
Copy the RPMs to an EOS device then run the 'swix create' command.
Examples:
Puppet Open Source:
cd /mnt/flash; \
swix create rbeapi-0.4.0-1.swix \
rubygem-rbeapi-0.4.0-1.eos4.noarch.rpm \
rubygem-inifile-3.0.0-3.eos4.noarch.rpm \
rubygem-netaddr-1.5.0-2.eos4.noarch.rpm \
rubygem-net_http_unix-0.2.1-3.eos4.noarch.rpm
Puppet-enterprise agent (3.x):
cd/mnt/flash; \
swix create rbeapi-puppet3-0.4.0-1.swix \
rubygem-rbeapi-puppet3-0.4.0-1.eos4.noarch.rpm \
rubygem-inifile-puppet3-3.0.0-3.eos4.noarch.rpm \
rubygem-netaddr-puppet3-1.5.0-2.eos4.noarch.rpm
Puppet-All-in-one agent (2015.x/4.x):
cd/mnt/flash; \
swix create rbeapi-puppet-aio-0.4.0-1.swix \
rubygem-rbeapi-puppet-aio-0.4.0-1.eos4.noarch.rpm \
rubygem-inifile-puppet-aio-3.0.0-3.eos4.noarch.rpm \
rubygem-netaddr-puppet-aio-1.5.0-2.eos4.noarch.rpm \
rubygem-net_http_unix-puppet-aio-0.2.1-3.eos4.noarch.rpm
```

On EOS:
```
Arista# copy <URI-to-RPMs> flash:
Arista# bash
-bash-4.1# cd /mnt/flash/
-bash-4.1# swix create pe-rbeapi-0.3.0-1.swix \
pe-rubygem-rbeapi-0.1.0-1.eos4.noarch.rpm \
pe-rubygem-inifile-3.0.0-1.eos4.noarch.rpm \
pe-rubygem-netaddr-1.5.0-1.eos4.noarch.rpm
-bash-4.1# swix create rbeapi-puppet3-0.4.0-1.swix \
rubygem-rbeapi-puppet3-0.4.0-1.eos4.noarch.rpm \
rubygem-inifile-puppet3-3.0.0-1.eos4.noarch.rpm \
rubygem-netaddr-puppet3-1.5.0-1.eos4.noarch.rpm
-bash-4.1# exit
Arista# copy flash:pe-rbeapi-0.3.0-1.swix extension:
Arista# extension pe-rbeapi-0.3.0-1.swix
Arista# copy flash:rbeapi-puppet3-0.4.0-1.swix extension:
Arista# extension rbeapi-puppet3-0.4.0-1.swix
Arista# copy installed-extensions boot-extensions
```

# Upgrading

On EOS:
```
Arista# no extension pe-rbeapi-0.2.0-1.swix
Arista# extension pe-rbeapi-0.3.0-1.swix
Arista# no extension pe-rbeapi-0.3.0-1.swix
Arista# extension rbeapi-puppet3-0.4.0-1.swix
Arista# copy installed-extensions boot-extensions
```

Expand Down
66 changes: 48 additions & 18 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ task rpm: :build do
system "sed -e 's/^Version:.*/Version: #{Rbeapi::VERSION}/g' " \
'rbeapi.spec.tmpl > rbeapi.spec'
system "rpmbuild #{RPM_OPTS} rbeapi.spec"
system "rpmbuild #{RPM_OPTS} --define 'enterprise 1' rbeapi.spec"
RPMS = `find rpms/noarch -name "*rbeapi*rpm"`
puts "\n################################################\n#"
puts "Created the following in rpms/noarch/\n#{RPMS}"
Expand All @@ -33,8 +32,6 @@ task :inifile do
system "sed -e 's/^Version:.*/Version: #{INIFILE_VERSION}/g' " \
'gems/inifile/inifile.spec.tmpl > gems/inifile/inifile.spec'
system "rpmbuild #{RPM_OPTS} gems/inifile/inifile.spec"
system "rpmbuild #{RPM_OPTS} --define 'enterprise 1' " \
'gems/inifile/inifile.spec'
RPMS = `find rpms/noarch -name "*inifile*rpm"`
puts "\n################################################\n#"
puts "Created the following in rpms/noarch/\n#{RPMS}"
Expand Down Expand Up @@ -70,8 +67,6 @@ task :netaddr do
system "sed -e 's/^Version:.*/Version: #{NETADDR_VERSION}/g' " \
'gems/netaddr/netaddr.spec.tmpl > gems/netaddr/netaddr.spec'
system "rpmbuild #{RPM_OPTS} gems/netaddr/netaddr.spec"
system "rpmbuild #{RPM_OPTS} --define 'enterprise 1' " \
'gems/netaddr/netaddr.spec'
RPMS = `find rpms/noarch -name "*netaddr*rpm"`
puts "\n################################################\n#"
puts "Created the following in rpms/noarch/\n#{RPMS}"
Expand All @@ -87,19 +82,54 @@ task all_rpms: :build do
puts 'RPMs are available in rpms/noarch/'
puts "Copy the RPMs to an EOS device then run the 'swix create' command."
puts ' Examples: '
puts ' Puppet Open Source: '
puts ' cd /mnt/flash; \\'
puts " swix create rbeapi-#{Rbeapi::VERSION}-1.swix \\"
puts " rubygem-rbeapi-#{Rbeapi::VERSION}-1.eos4.noarch.rpm \\"
puts ' rubygem-inifile-3.0.0-2.eos4.noarch.rpm \\'
puts ' rubygem-netaddr-1.5.0-1.eos4.noarch.rpm \\'
puts ' rubygem-net_http_unix-0.2.1-2.eos4.noarch.rpm'
puts ' Puppet-enterprise: '
puts ' cd/mnt/flash; \\'
puts " swix create pe-rbeapi-#{Rbeapi::VERSION}-1.swix \\"
puts " pe-rubygem-rbeapi-#{Rbeapi::VERSION}-1.eos4.noarch.rpm \\"
puts ' pe-rubygem-inifile-3.0.0-2.eos4.noarch.rpm \\'
puts ' pe-rubygem-netaddr-1.5.0-1.eos4.noarch.rpm'
puts ' Puppet Open Source: '
puts ' cd /mnt/flash; \\'
puts " swix create rbeapi-#{Rbeapi::VERSION}-1.swix \\"
puts " rubygem-rbeapi-#{Rbeapi::VERSION}-1.eos4.noarch.rpm \\"
puts ' rubygem-inifile-3.0.0-3.eos4.noarch.rpm \\'
puts ' rubygem-netaddr-1.5.0-2.eos4.noarch.rpm \\'
puts ' rubygem-net_http_unix-0.2.1-3.eos4.noarch.rpm'
puts ' Puppet-enterprise agent (3.x): '
puts ' cd/mnt/flash; \\'
puts " swix create rbeapi-puppet3-#{Rbeapi::VERSION}-1.swix \\"
puts " rubygem-rbeapi-puppet3-#{Rbeapi::VERSION}-1.eos4.noarch.rpm \\"
puts ' rubygem-inifile-puppet3-3.0.0-3.eos4.noarch.rpm \\'
puts ' rubygem-netaddr-puppet3-1.5.0-2.eos4.noarch.rpm'
puts ' Puppet-All-in-one agent (2015.x/4.x): '
puts ' cd/mnt/flash; \\'
puts " swix create rbeapi-puppet-aio-#{Rbeapi::VERSION}-1.swix \\"
puts " rubygem-rbeapi-puppet-aio-#{Rbeapi::VERSION}-1.eos4.noarch.rpm \\"
puts ' rubygem-inifile-puppet-aio-3.0.0-3.eos4.noarch.rpm \\'
puts ' rubygem-netaddr-puppet-aio-1.5.0-2.eos4.noarch.rpm \\'
puts ' rubygem-net_http_unix-puppet-aio-0.2.1-3.eos4.noarch.rpm'
end

desc 'Generate SWIX files from RPMs'
task swix: :all_rpms do
SWIX = 'PYTHONPATH=${PYTHONPATH}:/nfs/misc/tools/swix \
/nfs/misc/tools/swix/swix'
system "cd rpms/noarch;
rm -f rbeapi-#{Rbeapi::VERSION}-1.swix;
#{SWIX} create rbeapi-#{Rbeapi::VERSION}-1.swix \
rubygem-rbeapi-#{Rbeapi::VERSION}-1.eos4.noarch.rpm \
rubygem-inifile-3.0.0-3.eos4.noarch.rpm \
rubygem-netaddr-1.5.0-2.eos4.noarch.rpm"
system "cd rpms/noarch;
rm -f rbeapi-puppet3-#{Rbeapi::VERSION}-1.swix;
#{SWIX} create rbeapi-puppet3-#{Rbeapi::VERSION}-1.swix \
rubygem-rbeapi-puppet3-#{Rbeapi::VERSION}-1.eos4.noarch.rpm \
rubygem-inifile-puppet3-3.0.0-3.eos4.noarch.rpm \
rubygem-netaddr-puppet3-1.5.0-2.eos4.noarch.rpm"
system "cd rpms/noarch;
rm -f rbeapi-puppet-aio-#{Rbeapi::VERSION}-1.swix;
#{SWIX} create rbeapi-puppet-aio-#{Rbeapi::VERSION}-1.swix \
rubygem-rbeapi-puppet-aio-#{Rbeapi::VERSION}-1.eos4.noarch.rpm \
rubygem-inifile-puppet-aio-3.0.0-3.eos4.noarch.rpm \
rubygem-netaddr-puppet-aio-1.5.0-2.eos4.noarch.rpm"
SWIXS = `find rpms/noarch -name "rbeapi*swix" -ls`
puts "\n################################################\n#"
puts "The following artifacts are in rpms/noarch/\n#{SWIXS}"
puts "#\n################################################\n\n"
end

task release: :build do
Expand Down
64 changes: 50 additions & 14 deletions gems/inifile/inifile.spec.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,16 @@

Name: %{?enterprise:pe-}rubygem-%{gem_name}
Version: 3.0.0
Release: 2.eos4
Release: 3.eos4
Summary: INI file reader and writer

Group: Development/Languages
License: Unknown
URL: http://rubygems.org/gems/inifile
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem

%if 0%{?enterprise:1} == 1
# Use these settings for Puppet Enterprise
%global gem /opt/puppet/bin/gem
Requires: pe-ruby
Requires: pe-rubygems
Provides: pe-rubygem(%{gem_name}) = %{version}
Provides: pe-rubygem-%{gem_name} = %{version}
%else
# Use these settings for all other installs
%global gem gem
Requires: ruby(abi) = %{rubyabi}
Provides: ruby(%{gem_name}) = %{version}-%{release}
%endif

BuildArch: noarch

Expand Down Expand Up @@ -60,6 +49,25 @@ are also possible
var1 = baz
var2 = shoodle.

%package puppet3
Summary: Inifile rubygem packaged for Puppet 3.x on Arista EOS
Group: Development/Languages
Requires: pe-ruby
Requires: pe-rubygems
Provides: pe-rubygem(%{gem_name}) = %{version}
Provides: pe-rubygem-%{gem_name} = %{version}
%description puppet3
The inifile rubygem packaged for Puppet 3.x on Arista EOS.

%package puppet-aio
Summary: Inifile rubygem packaged for Puppet 2015 (4.x) on Arista EOS
Group: Development/Languages
# Use these settings for all other installs
Requires: puppet >= 4.0.0
Provides: rubygem-%{gem_name} = %{version}
%description puppet-aio
The inifile rubygem packaged for Puppet 2015 (4.x) on Arista EOS.

%prep
%setup -q -D -T -n .

Expand All @@ -70,13 +78,41 @@ install %{SOURCE0} %{buildroot}/
%files
/%{gem_name}-%{version}.gem

%files puppet3
/%{gem_name}-%{version}.gem

%files puppet-aio
/%{gem_name}-%{version}.gem

%post
%{gem} install --local /%{gem_name}-%{version}.gem > /dev/null 2>&1
GEM_OPTS="--no-document --local"
gem install ${GEM_OPTS} /%{gem_name}-%{version}.gem > /dev/null 2>&1

%preun
%{gem} uninstall %{gem_name} --version '= %{version}' > /dev/null 2>&1
gem uninstall %{gem_name} --version '= %{version}' > /dev/null 2>&1

%post puppet3
GEM=/opt/puppet/bin/gem
GEM_OPTS="--no-document --local"
${GEM} install ${GEM_OPTS} /%{gem_name}-%{version}.gem > /dev/null 2>&1

%preun puppet3
GEM=/opt/puppet/bin/gem
${GEM} uninstall %{gem_name} --version '= %{version}' > /dev/null 2>&1

%post puppet-aio
GEM=/opt/puppetlabs/puppet/bin/gem
GEM_OPTS="--no-document --local"
${GEM} install ${GEM_OPTS} /%{gem_name}-%{version}.gem > /dev/null 2>&1

%preun puppet-aio
GEM=/opt/puppetlabs/puppet/bin/gem
${GEM} uninstall %{gem_name} --version '= %{version}' > /dev/null 2>&1

%changelog
* Fri Oct 30 2015 Jere Julian - 3.0.0-3
- Detect the location of the puppet-agent's gem install

* Thu May 21 2015 Jere Julian - 3.0.0-2
- Ubuntu requires we manually create the buildroot

Expand Down
Loading

0 comments on commit 3ca991f

Please sign in to comment.