From f061f2752539da60ae894ba42ed567df7155314b Mon Sep 17 00:00:00 2001 From: Harm van Tilborg Date: Tue, 27 Oct 2015 09:52:10 +0100 Subject: Typo in Brocade NOS model --- lib/oxidized/model/nos.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/oxidized/model/nos.rb b/lib/oxidized/model/nos.rb index c2f4319..18ca6a2 100644 --- a/lib/oxidized/model/nos.rb +++ b/lib/oxidized/model/nos.rb @@ -26,7 +26,7 @@ class NOS < Oxidized::Model end cfg 'show system' do |cfg| - commen cfg.each_line.reject { |line| line.match /Time/ or line.match /speed/ } + comment cfg.each_line.reject { |line| line.match /Time/ or line.match /speed/ } end cmd 'show running-config' -- cgit v1.2.1 From 97a1c5c982dff389c205cae1b074cd0f1cd7af60 Mon Sep 17 00:00:00 2001 From: Marno van der Molen Date: Tue, 3 Nov 2015 08:04:55 +0100 Subject: Improve critical/pending/ok logic for nagios check --- extra/nagios_check_failing_nodes.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extra/nagios_check_failing_nodes.rb b/extra/nagios_check_failing_nodes.rb index 27a5c66..abb34ba 100644 --- a/extra/nagios_check_failing_nodes.rb +++ b/extra/nagios_check_failing_nodes.rb @@ -23,12 +23,12 @@ json.each do |node| end end -if pending - puts '[WARN] Pending backup: ' + pending_nodes.join(',') - exit 1 -elsif critical +if critical puts '[CRIT] Unable to backup: ' + critical_nodes.join(',') exit 2 +elsif pending + puts '[WARN] Pending backup: ' + pending_nodes.join(',') + exit 1 else puts '[OK] Backup of all nodes completed successfully.' exit 0 -- cgit v1.2.1 From a9996e8115bafd9837672c26dc9b76cbf3696840 Mon Sep 17 00:00:00 2001 From: Marno van der Molen Date: Tue, 3 Nov 2015 08:08:22 +0100 Subject: Adds optional debug output when loading hosts (resolving DNS) --- lib/oxidized/node.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/oxidized/node.rb b/lib/oxidized/node.rb index d50317f..c847416 100644 --- a/lib/oxidized/node.rb +++ b/lib/oxidized/node.rb @@ -9,6 +9,9 @@ module Oxidized attr_accessor :running, :user, :msg, :from, :stats, :retry alias :running? :running def initialize opt + if CFG.debug == true or opt[:debug] == true + puts 'resolving DNS for %s...' % opt[:name] + end @name = opt[:name] @ip = IPAddr.new(opt[:ip]).to_s rescue nil @ip ||= Resolv.new.getaddress @name -- cgit v1.2.1 From f04ada741166c7c2cd5f9eee29a89127fab1f328 Mon Sep 17 00:00:00 2001 From: Marno van der Molen Date: Tue, 3 Nov 2015 08:30:44 +0100 Subject: Log crashes on node name instead of ip to ease troubleshooting --- lib/oxidized/node.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/oxidized/node.rb b/lib/oxidized/node.rb index c847416..974b2d1 100644 --- a/lib/oxidized/node.rb +++ b/lib/oxidized/node.rb @@ -70,7 +70,7 @@ module Oxidized Log.send(level, '%s raised %s%s with msg "%s"' % [self.ip, err.class, resc, err.message]) return false rescue => err - file = Oxidized::Config::Crash + '.' + self.ip.to_s + file = Oxidized::Config::Crash + '.' + opt[:name] open file, 'w' do |fh| fh.puts Time.now.utc fh.puts err.message + ' [' + err.class.to_s + ']' -- cgit v1.2.1 From dc5f7285c87dc45763a24636a95c4081552356de Mon Sep 17 00:00:00 2001 From: Marno van der Molen Date: Tue, 3 Nov 2015 09:46:41 +0100 Subject: Revert crash logging on fqdn - seems to crash oxidized... --- lib/oxidized/node.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/oxidized/node.rb b/lib/oxidized/node.rb index 974b2d1..c847416 100644 --- a/lib/oxidized/node.rb +++ b/lib/oxidized/node.rb @@ -70,7 +70,7 @@ module Oxidized Log.send(level, '%s raised %s%s with msg "%s"' % [self.ip, err.class, resc, err.message]) return false rescue => err - file = Oxidized::Config::Crash + '.' + opt[:name] + file = Oxidized::Config::Crash + '.' + self.ip.to_s open file, 'w' do |fh| fh.puts Time.now.utc fh.puts err.message + ' [' + err.class.to_s + ']' -- cgit v1.2.1 From c0dc2ee2af5b6be0b237fa5a6cb60aed14943466 Mon Sep 17 00:00:00 2001 From: Saku Ytti Date: Fri, 6 Nov 2015 10:54:31 +0200 Subject: release 0.9.0 --- CHANGELOG.md | 5 +++++ oxidized.gemspec | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf3d8d5..d123b46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 0.9.0 +- FEATURE: input log now uses devices name as file, instead of string from config (by @skoef) +- FEATURE: Dell Networkign OS (dnos) support (by @erefre) +- BUGFIX: CiscoSMB, powerconnect, comware, xos, ironware, nos fixes + # 0.8.1 - BUGFIX: restore ruby 1.9.3 compatibility diff --git a/oxidized.gemspec b/oxidized.gemspec index d2956b1..1e42e73 100644 --- a/oxidized.gemspec +++ b/oxidized.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'oxidized' - s.version = '0.8.1' + s.version = '0.9.0' s.licenses = %w( Apache-2.0 ) s.platform = Gem::Platform::RUBY s.authors = [ 'Saku Ytti', 'Samer Abdel-Hafez', 'Anton Aksola' ] -- cgit v1.2.1 From 80a3c6d0a8e03c2d24ec04d3ddb113a825a03c74 Mon Sep 17 00:00:00 2001 From: Dan Baugher Date: Tue, 10 Nov 2015 21:29:29 -0500 Subject: Added a couple missing models. Fixed a typo in one of the names for the os. Restructured the list to separate models and brands. Updated the names to match the model names. --- README.md | 91 ++++++++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 58 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 97aa4ac..4f21c4d 100644 --- a/README.md +++ b/README.md @@ -42,39 +42,64 @@ Oxidized is a network device configuration backup tool. It's a RANCID replacemen # Supported OS types - * A10 Networks ACOS - * Alcatel-Lucent ISAM 7302/7330 - * Alcatel-Lucent Operating System AOS - * Alcatel-Lucent Operating System AOS7 - * Alcatel-Lucent Operating System Wireless - * Alcatel-Lucent TiMOS - * Arista EOS - * Brocade Fabric OS - * Brocade Ironware - * Brocade NOS (Network Operating System) - * Brocade Vyatta - * Cisco AireOS - * Cisco ASA - * Cisco IOS - * Cisco IOS-XR - * Cisco NXOS - * Cisco SMB (Nikola series) - * Cumulus Linux - * DELL PowerConnect - * Extreme Networks XOS - * Force10 FTOS - * Force10 NDOS - * FortiGate FortiOS - * HP Comware (HP A-series, H3C, 3Com) - * HP ProCurve - * Huawei VRP - * Juniper JunOS - * Juniper ScreenOS (Netscreen) - * Mikrotik RouterOS - * MRV Master-OS - * Ubiquiti AirOS - * Palo Alto PAN-OS - * Zyxel ZyNOS + * A10 Networks + * ACOS + * Alcatel-Lucent + * ISAM + * AOS + * AOS7 + * Wireless + * TiMOS + * Arista + * EOS + * Arris + * C4CMTS + * Aruba + * AOSW + * Brocade + * FabricOS + * Ironware + * NOS (Network Operating System) + * Vyatta + * Cisco + * AireOS + * ASA + * IOS + * IOSXR + * NXOS + * SMB (Nikola series) + * Cumulus + * Linux + * DELL + * PowerConnect + * AOSW + * Extreme Networks + * XOS + * Force10 + * FTOS + * Force10 + * DNOS + * FortiGate + * FortiOS + * HP + * Comware (HP A-series, H3C, 3Com) + * Procurve + * Huawei + * VRP + * Juniper + * JunOS + * ScreenOS (Netscreen) + * Mikrotik + * RouterOS + * MRV + * MasterOS + * Ubiquiti + * AirOS + * Edgeos + * Palo Alto + * PANOS + * Zyxel + * ZyNOS # Installation -- cgit v1.2.1 From eebdc62dfd61e6e43d8374ef669428f4432b0c26 Mon Sep 17 00:00:00 2001 From: Dan Baugher Date: Wed, 11 Nov 2015 23:50:17 -0500 Subject: Added upstart job for ubuntu RVM installs --- extra/rvm.oxidized.upstart | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 extra/rvm.oxidized.upstart diff --git a/extra/rvm.oxidized.upstart b/extra/rvm.oxidized.upstart new file mode 100644 index 0000000..23b5d69 --- /dev/null +++ b/extra/rvm.oxidized.upstart @@ -0,0 +1,18 @@ +start on started networking + +respawn + +setuid oxidized +setgid oxidized + +chdir /home/oxidized + +env HOME=/home/oxidized + +pre-start script + test -x /usr/local/rvm/wrappers/ruby-2.1.2/oxidized || { stop; exit 0; } +end script + +script + exec /usr/local/rvm/wrappers/ruby-2.1.2/oxidized +end script \ No newline at end of file -- cgit v1.2.1 From cb9f02548bbef0bdeb28a595031b700972bc7d1c Mon Sep 17 00:00:00 2001 From: Jeff Groom Date: Mon, 23 Nov 2015 18:12:14 +1300 Subject: added support for Ciena SOAS 6.x device type --- lib/oxidized/model/saos.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 lib/oxidized/model/saos.rb diff --git a/lib/oxidized/model/saos.rb b/lib/oxidized/model/saos.rb new file mode 100644 index 0000000..cada35b --- /dev/null +++ b/lib/oxidized/model/saos.rb @@ -0,0 +1,24 @@ +class SAOS < Oxidized::Model + + # Ciena SAOS switch + # used for 6.x devices + + comment '! ' + + cmd :all do |cfg| + cfg.each_line.to_a[1..-2].join + end + + cmd 'configuration show' do |cfg| + cfg + end + + cfg :telnet do + username /login:/ + password /assword:/ + end + cfg :telnet do + post_login 'system shell session set more off' + pre_logout 'exit' + end +end \ No newline at end of file -- cgit v1.2.1 From de223b17593d311527e94c97593e8addd7f31fce Mon Sep 17 00:00:00 2001 From: Saku Ytti Date: Mon, 23 Nov 2015 12:23:44 +0200 Subject: Add Ciena to README Remove trailing whitespaces --- README.md | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 4f21c4d..43cc89f 100644 --- a/README.md +++ b/README.md @@ -42,9 +42,9 @@ Oxidized is a network device configuration backup tool. It's a RANCID replacemen # Supported OS types - * A10 Networks + * A10 Networks * ACOS - * Alcatel-Lucent + * Alcatel-Lucent * ISAM * AOS * AOS7 @@ -56,49 +56,51 @@ Oxidized is a network device configuration backup tool. It's a RANCID replacemen * C4CMTS * Aruba * AOSW - * Brocade + * Brocade * FabricOS * Ironware * NOS (Network Operating System) * Vyatta - * Cisco + * Ciena + * SOAS + * Cisco * AireOS * ASA * IOS * IOSXR * NXOS * SMB (Nikola series) - * Cumulus + * Cumulus * Linux - * DELL + * DELL * PowerConnect * AOSW - * Extreme Networks + * Extreme Networks * XOS - * Force10 + * Force10 * FTOS - * Force10 + * Force10 * DNOS - * FortiGate + * FortiGate * FortiOS - * HP + * HP * Comware (HP A-series, H3C, 3Com) * Procurve - * Huawei + * Huawei * VRP - * Juniper + * Juniper * JunOS * ScreenOS (Netscreen) - * Mikrotik + * Mikrotik * RouterOS - * MRV + * MRV * MasterOS - * Ubiquiti + * Ubiquiti * AirOS * Edgeos - * Palo Alto + * Palo Alto * PANOS - * Zyxel + * Zyxel * ZyNOS -- cgit v1.2.1 From 96d2efa8ed31e1ea22674c3195c589eb15d584dc Mon Sep 17 00:00:00 2001 From: Saku Ytti Date: Wed, 25 Nov 2015 11:16:48 +0200 Subject: add placeholder 'version' method for file output --- lib/oxidized/output/file.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/oxidized/output/file.rb b/lib/oxidized/output/file.rb index 38c9917..3326a32 100644 --- a/lib/oxidized/output/file.rb +++ b/lib/oxidized/output/file.rb @@ -39,5 +39,9 @@ class OxidizedFile < Output end end + def version node, group + 'not implemented for file output' + end + end end -- cgit v1.2.1 From 4e23b4341cec6a1c4e7526bd3acafbe66c624fc5 Mon Sep 17 00:00:00 2001 From: Saku Ytti Date: Tue, 1 Dec 2015 11:21:47 +0200 Subject: meh further hack not to barf on version for files --- lib/oxidized/output/file.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/oxidized/output/file.rb b/lib/oxidized/output/file.rb index 3326a32..d1a8c17 100644 --- a/lib/oxidized/output/file.rb +++ b/lib/oxidized/output/file.rb @@ -40,7 +40,12 @@ class OxidizedFile < Output end def version node, group - 'not implemented for file output' + # not supported + [] + end + + def get_version node, group, oid + 'not supported' end end -- cgit v1.2.1 From 9d2ca3d1cb51cdddef45f584aa6c98e8e600f3b6 Mon Sep 17 00:00:00 2001 From: MrRJ45 Date: Thu, 17 Dec 2015 16:06:43 +0000 Subject: Identify Stackable Switches Change how we identify stackable switches using the word "Unit" to identify this. This is more reliable than identifying the Model number. --- lib/oxidized/model/powerconnect.rb | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/oxidized/model/powerconnect.rb b/lib/oxidized/model/powerconnect.rb index ec15402..cd04766 100644 --- a/lib/oxidized/model/powerconnect.rb +++ b/lib/oxidized/model/powerconnect.rb @@ -14,6 +14,9 @@ class PowerConnect < Oxidized::Model end cmd 'show version' do |cfg| + if (@stackable.nil?) + @stackable = true if cfg.match /(U|u)nit\s/ + end cfg = cfg.split("\n").select { |line| not line[/Up\sTime/] } comment cfg.join("\n") + "\n" end @@ -47,15 +50,17 @@ class PowerConnect < Oxidized::Model def clean cfg out = [] - skip_block = false + skip_blocks = 0 cfg.each_line do |line| - if line.match /Up\sTime|Temperature|Power Supplies/i - # For 34xx, 35xx, 54xx, 55xx, 62xx and 8024F we should skip this block (terminated by a blank line) - skip_block = true if @model =~ /^(34|35)(24|48)$|^(54|55)(24|48)$|^(62)(24|48)$|^8024$/ + # If this is a stackable switch we should skip this block of information + if (line.match /Up\sTime|Temperature|Power Suppl(ies|y)|Fans/i and @stackable == true) + skip_blocks = 1 + # Some switches have another empty line. This is identified by this line having a colon + skip_blocks = 2 if line.match /:/ end # If we have lines to skip do this until we reach and empty line - if skip_block - skip_block = false if /\S/ !~ line + if skip_blocks > 0 + skip_blocks -= 1 if /\S/ !~ line next end out << line.strip -- cgit v1.2.1 From 8e6d2d15dfcbfd01547ac33ba78f7e88ba3ef292 Mon Sep 17 00:00:00 2001 From: asynet Date: Mon, 21 Dec 2015 21:39:29 +0000 Subject: Update fortios.rb Changing the regex makes possible to backup devices with FortiOS 4.x and long names --- lib/oxidized/model/fortios.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/oxidized/model/fortios.rb b/lib/oxidized/model/fortios.rb index 2c796cb..a9d219c 100644 --- a/lib/oxidized/model/fortios.rb +++ b/lib/oxidized/model/fortios.rb @@ -2,7 +2,7 @@ class FortiOS < Oxidized::Model comment '# ' - prompt /^([-\w\.]+(\s[\(\w\-\.\)]+)?\s?[#>]\s?)$/ + prompt /^([-\w\.]+(\s[\(\w\-\.\)]+)?\~?\s?[#>]\s?)$/ cmd :all do |cfg, cmdstring| new_cfg = comment "COMMAND: #{cmdstring}\n" -- cgit v1.2.1 From 201c02551d96a070f8d55936aba350f772649465 Mon Sep 17 00:00:00 2001 From: Nick Hilliard Date: Sun, 27 Dec 2015 18:19:36 +0000 Subject: expose git repo name and commit oid in hook mechanism and environment variables --- README.md | 2 ++ lib/oxidized/hook/exec.rb | 2 ++ lib/oxidized/node.rb | 3 ++- lib/oxidized/output/file.rb | 3 +++ lib/oxidized/output/git.rb | 7 +++++-- lib/oxidized/worker.rb | 6 ++++-- 6 files changed, 18 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 43cc89f..f2116de 100644 --- a/README.md +++ b/README.md @@ -471,6 +471,8 @@ OX_NODE_MSG OX_NODE_GROUP OX_JOB_STATUS OX_JOB_TIME +OX_REPO_COMMITREF +OX_REPO_NAME ``` Exec hook recognizes following configuration keys: diff --git a/lib/oxidized/hook/exec.rb b/lib/oxidized/hook/exec.rb index af2aeb1..58d6fd5 100644 --- a/lib/oxidized/hook/exec.rb +++ b/lib/oxidized/hook/exec.rb @@ -71,6 +71,8 @@ class Exec < Oxidized::Hook "OX_NODE_MSG" => ctx.node.msg.to_s, "OX_NODE_GROUP" => ctx.node.group.to_s, "OX_EVENT" => ctx.event.to_s, + "OX_REPO_COMMITREF" => ctx.commitref.to_s, + "OX_REPO_NAME" => ctx.node.repo.to_s, ) end if ctx.job diff --git a/lib/oxidized/node.rb b/lib/oxidized/node.rb index c847416..df5b830 100644 --- a/lib/oxidized/node.rb +++ b/lib/oxidized/node.rb @@ -5,7 +5,7 @@ module Oxidized class MethodNotFound < OxidizedError; end class ModelNotFound < OxidizedError; end class Node - attr_reader :name, :ip, :model, :input, :output, :group, :auth, :prompt, :vars, :last + attr_reader :name, :ip, :model, :input, :output, :group, :auth, :prompt, :vars, :last, :repo attr_accessor :running, :user, :msg, :from, :stats, :retry alias :running? :running def initialize opt @@ -24,6 +24,7 @@ module Oxidized @vars = opt[:vars] @stats = Stats.new @retry = 0 + @repo = CFG.output.git.repo # model instance needs to access node instance @model.node = self diff --git a/lib/oxidized/output/file.rb b/lib/oxidized/output/file.rb index d1a8c17..eb915c3 100644 --- a/lib/oxidized/output/file.rb +++ b/lib/oxidized/output/file.rb @@ -2,6 +2,8 @@ module Oxidized class OxidizedFile < Output require 'fileutils' + attr_reader :commitref + def initialize @cfg = CFG.output.file end @@ -22,6 +24,7 @@ class OxidizedFile < Output FileUtils.mkdir_p file file = File.join file, node open(file, 'w') { |fh| fh.write outputs.to_cfg } + @commitref = file end def fetch node, group diff --git a/lib/oxidized/output/git.rb b/lib/oxidized/output/git.rb index 3757cfc..fff3941 100644 --- a/lib/oxidized/output/git.rb +++ b/lib/oxidized/output/git.rb @@ -7,6 +7,8 @@ class Git < Output raise OxidizedError, 'rugged not found: sudo gem install rugged' end + attr_reader :commitref + def initialize @cfg = CFG.output.git end @@ -27,6 +29,7 @@ class Git < Output @user = (opt[:user] or @cfg.user) @email = (opt[:email] or @cfg.email) @opt = opt + @commitref = nil repo = @cfg.repo outputs.types.each do |type| @@ -63,7 +66,7 @@ class Git < Output end end - #give a hash of all oid revision for the givin node, and the date of the commit + #give a hash of all oid revision for the given node, and the date of the commit def version node, group begin repo = @cfg.repo @@ -176,7 +179,7 @@ class Git < Output if tree_old != tree_new repo.config['user.name'] = user repo.config['user.email'] = email - Rugged::Commit.create(repo, + @commitref = Rugged::Commit.create(repo, :tree => index.write_tree(repo), :message => msg, :parents => repo.empty? ? [] : [repo.head.target].compact, diff --git a/lib/oxidized/worker.rb b/lib/oxidized/worker.rb index eea747e..c886a5b 100644 --- a/lib/oxidized/worker.rb +++ b/lib/oxidized/worker.rb @@ -39,11 +39,13 @@ module Oxidized msg = "update #{node.name}" msg += " from #{node.from}" if node.from msg += " with message '#{node.msg}'" if node.msg - if node.output.new.store node.name, job.config, + output = node.output.new + if output.store node.name, job.config, :msg => msg, :user => node.user, :group => node.group Log.info "Configuration updated for #{node.group}/#{node.name}" Oxidized.Hooks.handle :post_store, :node => node, - :job => job + :job => job, + :commitref => output.commitref end node.reset else -- cgit v1.2.1 From 18d084a99dad9c49a5123a67b19aad6540f15e11 Mon Sep 17 00:00:00 2001 From: Nick Hilliard Date: Sun, 27 Dec 2015 19:33:36 +0000 Subject: Added git-to-email script --- extra/oxidized-report-git-commits | 75 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100755 extra/oxidized-report-git-commits diff --git a/extra/oxidized-report-git-commits b/extra/oxidized-report-git-commits new file mode 100755 index 0000000..40fd2f4 --- /dev/null +++ b/extra/oxidized-report-git-commits @@ -0,0 +1,75 @@ +#!/bin/sh +# +# A script to maintain a local working copy of an oxidized configuration +# repository and mail out diffs for configuration changes +# +# Copyright 2016 Nick Hilliard , All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# usage: add the following hook to the oxidized config file: +# +# hooks: +# email_output: +# type: exec +# events: [post_store, node_fail] +# cmd: 'update-local-repo.sh ~/gitdir/ | mail -s "Oxidized updates for ${OX_NODE_NAME}" update-recipient@example.com' +# async: true +# timeout: 120 +# + +PATH=${PATH}:/usr/local/bin:/usr/local/sbin +export PATH + +gitdir=$1 + +if [ X${OX_REPO_COMMITREF} = "X" ]; then + echo \$OX_REPO_COMMITREF not set + exit 64 +fi + +if [ X${OX_REPO_NAME} = "X" ]; then + echo \$OX_REPO_NAME not set + exit 64 +fi + +if [ ! -d ${gitdir}/.git ]; then + git clone -q ${OX_REPO_NAME} ${gitdir} + + ret=$? + if [ X"${ret}" != X0 ] && [ X"${ret}" != X1 ]; then + echo git clone failed: aborting. + exit 128 + fi +fi + +cd ${gitdir} + +git pull -q > /dev/null 2>&1 +ret=$? +if [ X"${ret}" != X0 ] && [ X"${ret}" != X1 ]; then + echo git pull failed: aborting. + exit 128 +fi + +# Git is probably working at this stage, so safe to emit more info + +echo "Node name: ${OX_NODE_NAME}" +echo "Group Name: ${OX_NODE_GROUP}" +echo "Job Time: ${OX_JOB_TIME}" +echo "Git Commit ID: ${OX_REPO_COMMITREF}" +echo "Git Repo: ${OX_REPO_NAME}" +echo "Local working dir: ${gitdir}" +echo "" + +git diff --no-color ${OX_REPO_COMMITREF}~1..${OX_REPO_COMMITREF} -- cgit v1.2.1 From 1300400441870f0caad1f01f447a4d887c67b330 Mon Sep 17 00:00:00 2001 From: Nick Hilliard Date: Sun, 27 Dec 2015 19:45:12 +0000 Subject: added warning not to set the staging directory to be the same as the git repo --- extra/oxidized-report-git-commits | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/extra/oxidized-report-git-commits b/extra/oxidized-report-git-commits index 40fd2f4..2b1a2d7 100755 --- a/extra/oxidized-report-git-commits +++ b/extra/oxidized-report-git-commits @@ -27,6 +27,11 @@ # async: true # timeout: 120 # +# +# The script takes a single argument, namely a git working directory name, +# e.g. "~/gitdir/". This is only used as a staging directory and should +# not be set to be the same as the git repo directory. +# PATH=${PATH}:/usr/local/bin:/usr/local/sbin export PATH -- cgit v1.2.1 From 6e72e399626c0abb4cff7cea3d96505d4971e646 Mon Sep 17 00:00:00 2001 From: Tyler Christiansen Date: Tue, 29 Dec 2015 23:14:30 -0800 Subject: Fix groups vars. Fixes ytti/oxidized#242. Fixes ytti/oxidized-web#38. Added a check to verify the key exists for a group before returning. Might fic a group issue in ytti/oxidized#171. --- lib/oxidized/config/vars.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/oxidized/config/vars.rb b/lib/oxidized/config/vars.rb index b39e7fe..b0471f2 100644 --- a/lib/oxidized/config/vars.rb +++ b/lib/oxidized/config/vars.rb @@ -2,9 +2,14 @@ module Oxidized::Config::Vars # convenience method for accessing node, group or global level user variables # nil values will be ignored def vars name - r = @node.vars[name] unless @node.vars.nil? - r ||= Oxidized::CFG.groups[@node.group].vars[name.to_s] if Oxidized::CFG.groups.has_key?(@node.group) + r = @node.vars[name] unless @node.vars.nil? + if Oxidized::CFG.groups.has_key?(@node.group) + if Oxidized::CFG.groups[@node.group].vars.has_key?(name.to_s) + r ||= Oxidized::CFG.groups[@node.group].vars[name.to_s] + end + end r ||= Oxidized::CFG.vars[name.to_s] if Oxidized::CFG.vars.has_key?(name.to_s) r end end + -- cgit v1.2.1 From 7e8ce43493581f8dc384b8e09a89edf14df5e413 Mon Sep 17 00:00:00 2001 From: Tyler Christiansen Date: Tue, 29 Dec 2015 23:21:48 -0800 Subject: Update net-ssh version dependecy. Closes #214. --- oxidized.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oxidized.gemspec b/oxidized.gemspec index 1e42e73..eef386a 100644 --- a/oxidized.gemspec +++ b/oxidized.gemspec @@ -16,7 +16,7 @@ Gem::Specification.new do |s| s.required_ruby_version = '>= 1.9.3' s.add_runtime_dependency 'asetus', '~> 0.1' s.add_runtime_dependency 'slop', '~> 3.5' - s.add_runtime_dependency 'net-ssh', '~> 2.8' + s.add_runtime_dependency 'net-ssh', '~> 2.9', '>= 2.9.3' s.add_runtime_dependency 'rugged', '~> 0.21', '>= 0.21.4' s.add_development_dependency 'pry', '~> 0' end -- cgit v1.2.1 From 1ee130b83a28f822cdc3379c24d4965ceee86034 Mon Sep 17 00:00:00 2001 From: Elvin Efendi Date: Mon, 4 Jan 2016 10:24:46 -0500 Subject: merge version --- lib/oxidized/version.rb | 2 +- oxidized.gemspec | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/oxidized/version.rb b/lib/oxidized/version.rb index c2a0c0e..38772b7 100644 --- a/lib/oxidized/version.rb +++ b/lib/oxidized/version.rb @@ -1,3 +1,3 @@ module Oxidized - VERSION = '0.8.1' + VERSION = '0.9.0' end diff --git a/oxidized.gemspec b/oxidized.gemspec index 127a2de..83e31cd 100644 --- a/oxidized.gemspec +++ b/oxidized.gemspec @@ -5,11 +5,7 @@ require 'oxidized/version' Gem::Specification.new do |s| s.name = 'oxidized' -<<<<<<< HEAD s.version = Oxidized::VERSION -======= - s.version = '0.9.0' ->>>>>>> upstream/master s.licenses = %w( Apache-2.0 ) s.platform = Gem::Platform::RUBY s.authors = [ 'Saku Ytti', 'Samer Abdel-Hafez', 'Anton Aksola' ] -- cgit v1.2.1 From 52804b9f96a441c66cb957d001e71f48cc6a0811 Mon Sep 17 00:00:00 2001 From: Elvin Efendi Date: Mon, 4 Jan 2016 10:47:29 -0500 Subject: return back build related tasks --- Rakefile | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/Rakefile b/Rakefile index 2dc5415..3a1be5e 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,14 @@ require 'bundler/gem_tasks' require 'rake/testtask' +gemspec = eval(File.read(Dir['*.gemspec'].first)) +file = [gemspec.name, gemspec.version].join('-') + '.gem' + +desc 'Validate gemspec' +task :gemspec do + gemspec.validate +end + desc 'Run minitest' task :test do Rake::TestTask.new do |t| @@ -11,4 +19,31 @@ task :test do end end +desc 'Build gem' +task :build do + system "gem build #{gemspec.name}.gemspec" + FileUtils.mkdir_p 'gems' + FileUtils.mv file, 'gems' +end + +desc 'Install gem' +task :install => :build do + system "sudo -Es sh -c \'umask 022; gem install gems/#{file}\'" +end + +desc 'Remove gems' +task :clean do + FileUtils.rm_rf 'gems' +end + +desc 'Tag the release' +task :tag do + system "git tag #{gemspec.version}" +end + +desc 'Push to rubygems' +task :push => :tag do + system "gem push gems/#{file}" +end + task default: :test -- cgit v1.2.1 From f339170c877ca296987d66c0c44223a8cad1d338 Mon Sep 17 00:00:00 2001 From: Elvin Efendi Date: Mon, 4 Jan 2016 10:55:27 -0500 Subject: use latest net-ssh --- Gemfile.lock | 10 +++++----- oxidized.gemspec | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index bbdc4c8..b46ca2f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,9 +1,9 @@ PATH remote: . specs: - oxidized (0.8.1) + oxidized (0.9.0) asetus (~> 0.1) - net-ssh (~> 2.8) + net-ssh (~> 3.0, >= 3.0.2) rugged (~> 0.21, >= 0.21.4) slop (~> 3.5) @@ -14,10 +14,10 @@ GEM coderay (1.1.0) metaclass (0.0.4) method_source (0.8.2) - minitest (5.8.2) + minitest (5.8.3) mocha (1.1.0) metaclass (~> 0.0.1) - net-ssh (2.9.2) + net-ssh (3.0.2) pry (0.10.3) coderay (~> 1.1.0) method_source (~> 0.8.1) @@ -38,4 +38,4 @@ DEPENDENCIES rake (~> 10.0) BUNDLED WITH - 1.10.6 + 1.11.2 diff --git a/oxidized.gemspec b/oxidized.gemspec index 83e31cd..808d508 100644 --- a/oxidized.gemspec +++ b/oxidized.gemspec @@ -21,7 +21,7 @@ Gem::Specification.new do |s| s.required_ruby_version = '>= 1.9.3' s.add_runtime_dependency 'asetus', '~> 0.1' s.add_runtime_dependency 'slop', '~> 3.5' - s.add_runtime_dependency 'net-ssh', '~> 2.9', '>= 2.9.3' + s.add_runtime_dependency 'net-ssh', '~> 3.0', '>= 3.0.2' s.add_runtime_dependency 'rugged', '~> 0.21', '>= 0.21.4' s.add_development_dependency 'pry', '~> 0' s.add_development_dependency 'bundler', '~> 1.10' -- cgit v1.2.1