oxidized 0.20.0 → 0.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +1 -1
- data/README.md +135 -865
- data/docs/Configuration.md +186 -0
- data/docs/Hooks.md +143 -0
- data/docs/Outputs.md +190 -0
- data/docs/Ruby-API.md +115 -0
- data/docs/Sources.md +110 -0
- data/docs/Supported-OS-Types.md +149 -0
- data/docs/VRP-Huawei.md +27 -0
- data/extra/oxidized-report-git-commits +21 -40
- data/extra/oxidized-ubuntu.haproxy +45 -0
- data/extra/oxidized.service +4 -0
- data/lib/oxidized/hook.rb +1 -0
- data/lib/oxidized/hook/exec.rb +0 -1
- data/lib/oxidized/input/ssh.rb +11 -8
- data/lib/oxidized/model/acsw.rb +67 -0
- data/lib/oxidized/model/aen.rb +20 -0
- data/lib/oxidized/model/alteonos.rb +60 -0
- data/lib/oxidized/model/asa.rb +53 -18
- data/lib/oxidized/model/asyncos.rb +49 -0
- data/lib/oxidized/model/audiocodes.rb +32 -0
- data/lib/oxidized/model/boss.rb +76 -0
- data/lib/oxidized/model/ciscosma.rb +45 -0
- data/lib/oxidized/model/ciscosmb.rb +6 -1
- data/lib/oxidized/model/coriantgroove.rb +30 -0
- data/lib/oxidized/model/dlink.rb +1 -0
- data/lib/oxidized/model/enterasys.rb +30 -0
- data/lib/oxidized/model/fiberdriver.rb +1 -1
- data/lib/oxidized/model/fortios.rb +3 -1
- data/lib/oxidized/model/ftos.rb +2 -0
- data/lib/oxidized/model/hirschmann.rb +41 -0
- data/lib/oxidized/model/hpemsa.rb +13 -0
- data/lib/oxidized/model/ios.rb +2 -2
- data/lib/oxidized/model/iosxr.rb +1 -0
- data/lib/oxidized/model/ipos.rb +7 -1
- data/lib/oxidized/model/ironware.rb +4 -1
- data/lib/oxidized/model/netgear.rb +12 -4
- data/lib/oxidized/model/panos.rb +1 -1
- data/lib/oxidized/model/planet.rb +2 -1
- data/lib/oxidized/model/powerconnect.rb +5 -0
- data/lib/oxidized/model/procurve.rb +13 -0
- data/lib/oxidized/model/routeros.rb +12 -5
- data/lib/oxidized/model/sgos.rb +46 -0
- data/lib/oxidized/model/ucs.rb +31 -0
- data/lib/oxidized/model/voss.rb +12 -3
- data/lib/oxidized/model/vrp.rb +6 -0
- data/lib/oxidized/model/weos.rb +22 -0
- data/lib/oxidized/model/xos.rb +4 -0
- data/lib/oxidized/node.rb +4 -2
- data/lib/oxidized/nodes.rb +1 -0
- data/lib/oxidized/version.rb +1 -1
- data/lib/oxidized/worker.rb +23 -2
- data/oxidized.gemspec +1 -1
- metadata +54 -46
data/docs/Ruby-API.md
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
# Ruby API
|
2
|
+
|
3
|
+
The following objects exist in Oxidized.
|
4
|
+
|
5
|
+
## Input
|
6
|
+
* gets config from nodes
|
7
|
+
* must implement 'connect', 'get', 'cmd'
|
8
|
+
* 'ssh', 'telnet, ftp, and tftp' implemented
|
9
|
+
|
10
|
+
## Output
|
11
|
+
* stores config
|
12
|
+
* must implement 'store' (may implement 'fetch')
|
13
|
+
* 'git' and 'file' (store as flat ascii) implemented
|
14
|
+
|
15
|
+
## Source
|
16
|
+
* gets list of nodes to poll
|
17
|
+
* must implement 'load'
|
18
|
+
* source can have 'name', 'model', 'group', 'username', 'password', 'input', 'output', 'prompt'
|
19
|
+
* name - name of the devices
|
20
|
+
* model - model to use ios/junos/xyz, model is loaded dynamically when needed (Also default in config file)
|
21
|
+
* input - method to acquire config, loaded dynamically as needed (Also default in config file)
|
22
|
+
* output - method to store config, loaded dynamically as needed (Also default in config file)
|
23
|
+
* prompt - prompt used for node (Also default in config file, can be specified in model too)
|
24
|
+
* 'sql', 'csv' and 'http' (supports any format with single entry per line, like router.db)
|
25
|
+
|
26
|
+
## Model
|
27
|
+
### At the top level
|
28
|
+
A model may use several methods at the top level in the class. `cfg` is
|
29
|
+
executed in input/output/source context. `cmd` is executed within an instance
|
30
|
+
of the model.
|
31
|
+
|
32
|
+
#### `cfg`
|
33
|
+
`cfg` may be called with a list of methods (`:ssh`, `:telnet`) and a block with
|
34
|
+
zero parameters. Calling `cfg` registers the given access methods and calling
|
35
|
+
it at least once is required for a model to work.
|
36
|
+
|
37
|
+
The block may contain commands to change some behaviour for the given methods
|
38
|
+
(e.g. calling `post_login` to disable the pager).
|
39
|
+
|
40
|
+
#### `cmd`
|
41
|
+
Is used to specify commands that should be executed on a model in order to
|
42
|
+
gather its configuration. It can be called with:
|
43
|
+
|
44
|
+
* Just a string
|
45
|
+
* A string and a block
|
46
|
+
* `:all` and a block
|
47
|
+
* `:secret` and a block
|
48
|
+
|
49
|
+
The block takes a single parameter `cfg` containing the output of the command
|
50
|
+
being processed.
|
51
|
+
|
52
|
+
Calling `cmd` with just a string will emit the output of the command given in
|
53
|
+
that string as configuration.
|
54
|
+
|
55
|
+
Calling `cmd` with a string and a block will pass the output of the given
|
56
|
+
command to the block, then emit its return value (that must be a string) as
|
57
|
+
configuration.
|
58
|
+
|
59
|
+
Calling `cmd` with `:all` and a block will pass all command output through this
|
60
|
+
block before emitting it. This is useful if some cleanup is required of the
|
61
|
+
output of all commands.
|
62
|
+
|
63
|
+
Calling `cmd` with `:secret` and a block will pass all configuration to the
|
64
|
+
given block before emitting it to hide secrets if secret hiding is enabled. The
|
65
|
+
block should replace any secrets with `'<hidden>'` and return the resulting
|
66
|
+
string.
|
67
|
+
|
68
|
+
Execution order is `:all`, `:secret`, and lastly the command specific block, if
|
69
|
+
given.
|
70
|
+
|
71
|
+
#### `comment`
|
72
|
+
Called with a single string containing the string to prepend for comments in
|
73
|
+
emitted configuration for this model.
|
74
|
+
|
75
|
+
If not specified the default of `'# '` will be used (note the trailing space).
|
76
|
+
|
77
|
+
#### `prompt`
|
78
|
+
Is called with a regular expression that is used to detect when command output
|
79
|
+
ends after a command has been executed.
|
80
|
+
|
81
|
+
If not specified, a default of `/^([\w.@-]+[#>]\s?)$/` is used.
|
82
|
+
|
83
|
+
#### `expect`
|
84
|
+
Called with a regular expression and a block. The block takes two parameters:
|
85
|
+
the regular expression, and the data containing the match.
|
86
|
+
|
87
|
+
The passed data is replaced by the return value of the block.
|
88
|
+
|
89
|
+
`expect` can be used to, for example, strip escape sequences from output before
|
90
|
+
it's further processed.
|
91
|
+
|
92
|
+
### At the second level
|
93
|
+
The following methods are available:
|
94
|
+
|
95
|
+
#### `comment`
|
96
|
+
Used inside `cmd` invocations. Comments out every line in the passed string and
|
97
|
+
returns the result.
|
98
|
+
|
99
|
+
#### `password`
|
100
|
+
Used inside `cfg` invocations to specify the regular expression used to detect
|
101
|
+
the password prompt. If not specified, the default of `/^Password/` is used.
|
102
|
+
|
103
|
+
#### `post_login`
|
104
|
+
Used inside `cfg` invocations to specify commands to run once Oxidized has
|
105
|
+
logged in to the switch. Takes one argument that is either a block (taking zero
|
106
|
+
parameters) or a string containing a command to execute.
|
107
|
+
|
108
|
+
#### `pre_logout`
|
109
|
+
Used to specify commands to run before Oxidized closes the connection to the
|
110
|
+
switch. Takes one argument that is either a block (taking zero parameters) or a
|
111
|
+
string containing a command to execute.
|
112
|
+
|
113
|
+
#### `send`
|
114
|
+
Usually used inside `expect` or blocks passed to `post_login`/`pre_logout`.
|
115
|
+
Takes a single parameter: a string to be sent to the switch.
|
data/docs/Sources.md
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
## Source
|
2
|
+
|
3
|
+
### Source: CSV
|
4
|
+
|
5
|
+
One line per device, colon seperated. If `ip` isn't present, a DNS lookup will be done against `name`. For large installations, setting `ip` will dramatically reduce startup time.
|
6
|
+
|
7
|
+
```
|
8
|
+
source:
|
9
|
+
default: csv
|
10
|
+
csv:
|
11
|
+
file: /var/lib/oxidized/router.db
|
12
|
+
delimiter: !ruby/regexp /:/
|
13
|
+
map:
|
14
|
+
name: 0
|
15
|
+
ip: 1
|
16
|
+
model: 2
|
17
|
+
username: 3
|
18
|
+
password: 4
|
19
|
+
vars_map:
|
20
|
+
enable: 5
|
21
|
+
```
|
22
|
+
|
23
|
+
Example csv `/var/lib/oxidized/router.db`:
|
24
|
+
|
25
|
+
```
|
26
|
+
rtr01.local,192.168.1.1,ios,oxidized,5uP3R53cR3T,T0p53cR3t
|
27
|
+
```
|
28
|
+
|
29
|
+
### Source: SQL
|
30
|
+
Oxidized uses the `sequel` ruby gem. You can use a variety of databases that aren't explicitly listed. For more information visit https://github.com/jeremyevans/sequel Make sure you have the correct adapter!
|
31
|
+
### Source: MYSQL
|
32
|
+
|
33
|
+
`sudo apt-get install libmysqlclient-dev`
|
34
|
+
|
35
|
+
The values correspond to your fields in the DB such that ip, model, etc are field names in the DB
|
36
|
+
|
37
|
+
```
|
38
|
+
source:
|
39
|
+
default: sql
|
40
|
+
sql:
|
41
|
+
adapter: mysql2
|
42
|
+
database: oxidized
|
43
|
+
table: nodes
|
44
|
+
user: root
|
45
|
+
password: rootpass
|
46
|
+
map:
|
47
|
+
name: ip
|
48
|
+
model: model
|
49
|
+
username: username
|
50
|
+
password: password
|
51
|
+
vars_map:
|
52
|
+
enable: enable
|
53
|
+
```
|
54
|
+
|
55
|
+
### Source: SQLite
|
56
|
+
|
57
|
+
One row per device, filtered by hostname.
|
58
|
+
|
59
|
+
```
|
60
|
+
source:
|
61
|
+
default: sql
|
62
|
+
sql:
|
63
|
+
adapter: sqlite
|
64
|
+
database: "/var/lib/oxidized/devices.db"
|
65
|
+
table: devices
|
66
|
+
map:
|
67
|
+
name: fqdn
|
68
|
+
model: model
|
69
|
+
username: username
|
70
|
+
password: password
|
71
|
+
vars_map:
|
72
|
+
enable: enable
|
73
|
+
```
|
74
|
+
|
75
|
+
### Source: HTTP
|
76
|
+
|
77
|
+
One object per device.
|
78
|
+
|
79
|
+
HTTP Supports basic auth, configure the user and pass you want to use under the http: section.
|
80
|
+
|
81
|
+
```
|
82
|
+
source:
|
83
|
+
default: http
|
84
|
+
http:
|
85
|
+
url: https://url/api
|
86
|
+
scheme: https
|
87
|
+
delimiter: !ruby/regexp /:/
|
88
|
+
user: username
|
89
|
+
pass: password
|
90
|
+
map:
|
91
|
+
name: hostname
|
92
|
+
model: os
|
93
|
+
username: username
|
94
|
+
password: password
|
95
|
+
vars_map:
|
96
|
+
enable: enable
|
97
|
+
headers:
|
98
|
+
X-Auth-Token: 'somerandomstring'
|
99
|
+
```
|
100
|
+
|
101
|
+
You can also pass `secure: false` if you want to disable ssl certificate verification:
|
102
|
+
|
103
|
+
```
|
104
|
+
source:
|
105
|
+
default: http
|
106
|
+
http:
|
107
|
+
url: https://url/api
|
108
|
+
scheme: https
|
109
|
+
secure: false
|
110
|
+
```
|
@@ -0,0 +1,149 @@
|
|
1
|
+
# Supported OS types
|
2
|
+
* Vendor
|
3
|
+
* OS model
|
4
|
+
* A10 Networks
|
5
|
+
* [ACOS](/lib/oxidized/model/acos.rb)
|
6
|
+
* Accedian Performance Elements (NIDs)
|
7
|
+
* [AEN](/lib/oxidized/model/aen.rb)
|
8
|
+
* Alcatel-Lucent
|
9
|
+
* [AOS](/lib/oxidized/model/aos.rb)
|
10
|
+
* [AOS7](/lib/oxidized/model/aos7.rb)
|
11
|
+
* [ISAM](/lib/oxidized/model/isam.rb)
|
12
|
+
* [SR OS (Formerly TiMOS)](/lib/oxidized/model/timos.rb)
|
13
|
+
* Wireless
|
14
|
+
* Alvarion
|
15
|
+
* [BreezeACCESS](/lib/oxidized/model/alvarion.rb)
|
16
|
+
* APC
|
17
|
+
* [AOS](/lib/oxidized/model/apc_aos.rb)
|
18
|
+
* Arista
|
19
|
+
* [EOS](/lib/oxidized/model/eos.rb)
|
20
|
+
* Arris
|
21
|
+
* [C4CMTS](/lib/oxidized/model/c4cmts.rb)
|
22
|
+
* Aruba
|
23
|
+
* [AOSW](/lib/oxidized/model/aosw.rb)
|
24
|
+
* AudioCodes
|
25
|
+
* [AudioCodes](/lib/oxdized/model/audiocodes.rb)
|
26
|
+
* Avaya
|
27
|
+
* [VOSS (VSP Operating System Software)](/lib/oxidized/model/voss.rb)
|
28
|
+
* [BOSS (Baystack Operating System Software)](/lib/oxidized/model/boss.rb)
|
29
|
+
* Brocade
|
30
|
+
* [FabricOS](/lib/oxidized/model/fabricos.rb)
|
31
|
+
* [Ironware](/lib/oxidized/model/ironware.rb)
|
32
|
+
* [NOS (Network Operating System)](/lib/oxidized/model/nos.rb)
|
33
|
+
* [Vyatta](/lib/oxidized/model/vyatta.rb)
|
34
|
+
* [6910](/lib/oxidized/model/br6910.rb)
|
35
|
+
* Casa
|
36
|
+
* [Casa](/lib/oxidized/model/casa.rb)
|
37
|
+
* Check Point
|
38
|
+
* [GaiaOS](/lib/oxidized/model/gaiaos.rb)
|
39
|
+
* Ciena
|
40
|
+
* [SAOS](/lib/oxidized/model/saos.rb)
|
41
|
+
* Cisco
|
42
|
+
* [ACSW](/lib/oxidized/model/acsw.rb)
|
43
|
+
* [AireOS](/lib/oxidized/model/aireos.rb)
|
44
|
+
* [ASA](/lib/oxidized/model/asa.rb)
|
45
|
+
* [AsyncOS](/lib/oxidized/model/asyncos.rb)
|
46
|
+
* [CatOS](/lib/oxidized/model/catos.rb)
|
47
|
+
* [IOS](/lib/oxidized/model/ios.rb)
|
48
|
+
* [IOSXR](/lib/oxidized/model/iosxr.rb)
|
49
|
+
* [NGA](/lib/oxidized/model/cisconga.rb)
|
50
|
+
* [NXOS](/lib/oxidized/model/nxos.rb)
|
51
|
+
* [SMA](/lib/oxidized/model/ciscosma.rb)
|
52
|
+
* [SMB (Nikola series)](/lib/oxidized/model/ciscosmb.rb)
|
53
|
+
* [UCS](/lib/oxidized/model/ucs.rb)
|
54
|
+
* Citrix
|
55
|
+
* [NetScaler (Virtual Applicance)](/lib/oxidized/model/netscaler.rb)
|
56
|
+
* Coriant (former Tellabs)
|
57
|
+
* [TMOS (8800)](/lib/oxidized/model/corianttmos.rb)
|
58
|
+
* [8600](/lib/oxidized/model/coriant8600.rb)
|
59
|
+
* [Groove](/lib/oxidized/model/coriantgroove.rb)
|
60
|
+
* Cumulus
|
61
|
+
* [Linux](/lib/oxidized/model/cumulus.rb)
|
62
|
+
* DataCom
|
63
|
+
* [DmSwitch 3000](/lib/oxidized/model/datacom.rb)
|
64
|
+
* DCN
|
65
|
+
* [DCN](/lib/oxidized/model/ios.rb) - Map this to ios.
|
66
|
+
* DELL
|
67
|
+
* [PowerConnect](/lib/oxidized/model/powerconnect.rb)
|
68
|
+
* [AOSW](/lib/oxidized/model/aosw.rb)
|
69
|
+
* D-Link
|
70
|
+
* [D-Link](/lib/oxidized/model/dlink.rb)
|
71
|
+
* Ericsson/Redback
|
72
|
+
* [IPOS (former SEOS)](/lib/oxidized/model/ipos.rb)
|
73
|
+
* Extreme Networks
|
74
|
+
* [Enterasys](/lib/oxidized/model/enterasys.rb)
|
75
|
+
* [WM](/lib/oxidized/model/mtrlrfs.rb)
|
76
|
+
* [XOS](/lib/oxidized/model/xos.rb)
|
77
|
+
* F5
|
78
|
+
* [TMOS](/lib/oxidized/model/tmos.rb)
|
79
|
+
* Force10
|
80
|
+
* [DNOS](/lib/oxidized/model/dnos.rb)
|
81
|
+
* [FTOS](/lib/oxidized/model/ftos.rb)
|
82
|
+
* FortiGate
|
83
|
+
* [FortiOS](/lib/oxidized/model/fortios.rb)
|
84
|
+
* Fujitsu
|
85
|
+
* [PRIMERGY Blade switch 1/10Gbe](/lib/oxidized/model/fujitsupy.rb)
|
86
|
+
* Hatteras
|
87
|
+
* [Hatteras](/lib/oxidized/model/hatteras.rb)
|
88
|
+
* Hirschmann
|
89
|
+
* [HiOS](/lib/oxidized/model/hirschmann.rb)
|
90
|
+
* HP
|
91
|
+
* [Comware (HP A-series, H3C, 3Com)](/lib/oxidized/model/comware.rb)
|
92
|
+
* [Procurve](/lib/oxidized/model/procurve.rb)
|
93
|
+
* [BladeSystem (Onboard Administrator)](/lib/oxidized/model/hpebladesystem.rb)
|
94
|
+
* [MSA](/lib/oxidized/model/hpemsa.rb)
|
95
|
+
* Huawei
|
96
|
+
* [VRP](/lib/oxidized/model/vrp.rb)
|
97
|
+
* Juniper
|
98
|
+
* [JunOS](/lib/oxidized/model/junos.rb)
|
99
|
+
* [ScreenOS (Netscreen)](/lib/oxidized/model/screenos.rb)
|
100
|
+
* Mellanox
|
101
|
+
* [MLNX-OS](/lib/oxidized/model/mlnxos.rb)
|
102
|
+
* [Voltaire](/lib/oxidized/model/voltaire.rb)
|
103
|
+
* Mikrotik
|
104
|
+
* [RouterOS](/lib/oxidized/model/routeros.rb)
|
105
|
+
* Motorola
|
106
|
+
* [RFS](/lib/oxidized/model/mtrlrfs.rb)
|
107
|
+
* MRV
|
108
|
+
* [MasterOS](/lib/oxidized/model/masteros.rb)
|
109
|
+
* [FiberDriver](/lib/oxidized/model/fiberdriver.rb)
|
110
|
+
* Netgear
|
111
|
+
* [Netgear](/lib/oxidized/model/netgear.rb)
|
112
|
+
* Netonix
|
113
|
+
* [WISP Switch (As Netonix)](/lib/oxidized/model/netonix.rb)
|
114
|
+
* Nokia (formerly TiMetra, Alcatel, Alcatel-Lucent)
|
115
|
+
* [SR OS (TiMOS)](/lib/oxidized/model/timos.rb)
|
116
|
+
* OneAccess
|
117
|
+
* [OneOS](/lib/oxidized/model/oneos.rb)
|
118
|
+
* Opengear
|
119
|
+
* [Opengear](/lib/oxidized/model/opengear.rb)
|
120
|
+
* Palo Alto
|
121
|
+
* [PANOS](/lib/oxidized/model/panos.rb)
|
122
|
+
* [PLANET SG/SGS Switches](/lib/oxidized/model/planet.rb)
|
123
|
+
* [pfSense](/lib/oxidized/model/pfsense.rb)
|
124
|
+
* Radware
|
125
|
+
* [AlteonOS](/lib/oxidized/model/alteonos.rb)
|
126
|
+
* Quanta
|
127
|
+
* [Quanta / VxWorks 6.6 (1.1.0.8)](/lib/oxidized/model/quantaos.rb)
|
128
|
+
* Siklu
|
129
|
+
* [EtherHaul](/lib/oxidized/model/siklu.rb)
|
130
|
+
* Supermicro
|
131
|
+
* [Supermicro](/lib/oxidized/model/supermicro.rb)
|
132
|
+
* Symantec
|
133
|
+
* [Blue Coat ProxySG / Security Gateway OS (SGOS)](/lib/oxidized/model/sgos.rb)
|
134
|
+
* Trango Systems
|
135
|
+
* [Trango](/lib/oxidized/model/trango.rb)
|
136
|
+
* TPLink
|
137
|
+
* [TPLink](/lib/oxidized/model/tplink.rb)
|
138
|
+
* Ubiquiti
|
139
|
+
* [AirOS](/lib/oxidized/model/airos.rb)
|
140
|
+
* [Edgeos](/lib/oxidized/model/edgeos.rb)
|
141
|
+
* [EdgeSwitch](/lib/oxidized/model/edgeswitch.rb)
|
142
|
+
* Watchguard
|
143
|
+
* [Fireware OS](/lib/oxidized/model/firewareos.rb)
|
144
|
+
* Westell
|
145
|
+
* [Westell 8178G, Westell 8266G](/lib/oxidized/model/weos.rb)
|
146
|
+
* Zhone
|
147
|
+
* [Zhone (OLT and MX)](/lib/oxidized/model/zhoneolt.rb)
|
148
|
+
* Zyxel
|
149
|
+
* [ZyNOS](/lib/oxidized/model/zynos.rb)
|
data/docs/VRP-Huawei.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
Huawei VRP Configuration
|
2
|
+
========================
|
3
|
+
|
4
|
+
Create a user with no privileges
|
5
|
+
|
6
|
+
<HUAWEI> system-view
|
7
|
+
[~HUAWEI] aaa
|
8
|
+
[~HUAWEI-aaa] local-user oxidized password irreversible-cipher verysecret
|
9
|
+
[*HUAWEI-aaa] local-user oxidized level 1
|
10
|
+
[*HUAWEI-aaa] local-user oxidized service-type terminal ssh
|
11
|
+
[*HUAWEI-aaa] commit
|
12
|
+
|
13
|
+
The commands Oxidized executes are:
|
14
|
+
|
15
|
+
1. screen-length 0 temporary
|
16
|
+
2. display version
|
17
|
+
3. display device
|
18
|
+
4. display current-configuration all
|
19
|
+
|
20
|
+
Command 2 and 3 can be executed without issues, but 1 and 4 are only available for higher level users. Instead of making Oxidized a read/write user on your device, lower the priviledge-level for commands 1 and 4:
|
21
|
+
|
22
|
+
<HUAWEI> system-view
|
23
|
+
[~HUAWEI] command-privilege level 1 view global display current-configuration all
|
24
|
+
[*HUAWEI] command-privilege level 1 view shell screen-length
|
25
|
+
[*HUAWEI] commit
|
26
|
+
|
27
|
+
Oxidized can now retrieve your configuration!
|
@@ -17,64 +17,45 @@
|
|
17
17
|
# See the License for the specific language governing permissions and
|
18
18
|
# limitations under the License.
|
19
19
|
#
|
20
|
+
# 20170615 - Andre Sencioles <asenci@gmail.com>
|
21
|
+
# Removed requirement for Git working directory
|
22
|
+
# Check job status
|
23
|
+
#
|
24
|
+
#
|
20
25
|
# usage: add the following hook to the oxidized config file:
|
21
26
|
#
|
22
27
|
# hooks:
|
23
28
|
# email_output:
|
24
29
|
# type: exec
|
25
30
|
# events: [post_store, node_fail]
|
26
|
-
# cmd: '/home/oxidized/extra/oxidized-report-git-commits
|
31
|
+
# cmd: '/home/oxidized/extra/oxidized-report-git-commits | mail -s "Oxidized updates for ${OX_NODE_NAME}" update-recipient@example.com'
|
27
32
|
# async: true
|
28
33
|
# timeout: 120
|
29
34
|
#
|
30
35
|
#
|
31
|
-
# The script takes a single argument, namely a git working directory name,
|
32
|
-
# e.g. "~/gitdir/". This is only used as a staging directory and should
|
33
|
-
# not be set to be the same as the git repo directory.
|
34
|
-
#
|
35
36
|
|
36
|
-
|
37
|
-
|
37
|
+
echo "Node name: ${OX_NODE_NAME}"
|
38
|
+
echo "Group name: ${OX_NODE_GROUP}"
|
39
|
+
echo "Job status: ${OX_JOB_STATUS}"
|
40
|
+
echo "Job time: ${OX_JOB_TIME}"
|
38
41
|
|
39
|
-
|
42
|
+
if [ "${OX_EVENT}" = "node_fail" ]; then
|
43
|
+
echo 'Job failed'
|
44
|
+
exit 64
|
45
|
+
fi
|
40
46
|
|
41
|
-
if [
|
42
|
-
echo
|
47
|
+
if [ -z "${OX_REPO_COMMITREF}" ]; then
|
48
|
+
echo '$OX_REPO_COMMITREF not set'
|
43
49
|
exit 64
|
44
50
|
fi
|
45
51
|
|
46
|
-
if [
|
47
|
-
echo
|
52
|
+
if [ -z "${OX_REPO_NAME}" ]; then
|
53
|
+
echo '$OX_REPO_NAME not set'
|
48
54
|
exit 64
|
49
55
|
fi
|
50
56
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
ret=$?
|
55
|
-
if [ X"${ret}" != X0 ] && [ X"${ret}" != X1 ]; then
|
56
|
-
echo git clone failed: aborting.
|
57
|
-
exit 128
|
58
|
-
fi
|
59
|
-
fi
|
60
|
-
|
61
|
-
cd ${gitdir}
|
62
|
-
|
63
|
-
git pull -q > /dev/null 2>&1
|
64
|
-
ret=$?
|
65
|
-
if [ X"${ret}" != X0 ] && [ X"${ret}" != X1 ]; then
|
66
|
-
echo git pull failed: aborting.
|
67
|
-
exit 128
|
68
|
-
fi
|
69
|
-
|
70
|
-
# Git is probably working at this stage, so safe to emit more info
|
71
|
-
|
72
|
-
echo "Node name: ${OX_NODE_NAME}"
|
73
|
-
echo "Group Name: ${OX_NODE_GROUP}"
|
74
|
-
echo "Job Time: ${OX_JOB_TIME}"
|
75
|
-
echo "Git Commit ID: ${OX_REPO_COMMITREF}"
|
76
|
-
echo "Git Repo: ${OX_REPO_NAME}"
|
77
|
-
echo "Local working dir: ${gitdir}"
|
57
|
+
echo "Git repo: ${OX_REPO_NAME}"
|
58
|
+
echo "Git commit ID: ${OX_REPO_COMMITREF}"
|
78
59
|
echo ""
|
79
60
|
|
80
|
-
git
|
61
|
+
git --bare --git-dir="${OX_REPO_NAME}" show --pretty='' --no-color "${OX_REPO_COMMITREF}"
|