op5util 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Readme.md +7 -2
- data/bin/op5util +1 -1
- data/lib/op5util/schedule_downtime.rb +11 -4
- data/lib/op5util/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 244a87f1ddb3cc6a6003191f359bef310cf71e2c
|
4
|
+
data.tar.gz: e36893b667498b0f818f3d84e062d8221bd31843
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4076162159a79cb18b6b91d559879937e55e81ae65151c275ab26ca8f0146aed8a37c96dbc3df0dee91a414b8f21a9d0399a40f5e88c4286b7f227d8491e2457
|
7
|
+
data.tar.gz: 532e210da4878d9488db6bfd09bd07b0ef64e0c99ac51de13e7d480dd9bc0351f8b7d05fa917780851c024c93132f77db637dda1f1ea9274a58609c0c7d1e5a0
|
data/Readme.md
CHANGED
@@ -15,6 +15,7 @@
|
|
15
15
|
- [Roadmap, TODO](#roadmap-todo)
|
16
16
|
- [Contact, bug-reports etc](#contact-bug-reports-etc)
|
17
17
|
- [Version history](#version-history)
|
18
|
+
|
18
19
|
- [How op5util may be used with ansible](#how-op5util-may-be-used-with-ansible)
|
19
20
|
|
20
21
|
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
@@ -159,7 +160,7 @@ SYNOPSIS
|
|
159
160
|
op5util [global options] command [command options] [arguments...]
|
160
161
|
|
161
162
|
VERSION
|
162
|
-
0.1.
|
163
|
+
0.1.8
|
163
164
|
|
164
165
|
GLOBAL OPTIONS
|
165
166
|
-f, --authfile=authfile - Authfile containing "username:password" used to authenticate with Op5
|
@@ -182,7 +183,7 @@ COMMANDS
|
|
182
183
|
add_hostgroups - Add host to a new hostgroup(s)
|
183
184
|
autocomplete - Show instruction on howto setup tab autocomplete for op5util in your shell
|
184
185
|
commit - Commit any pending changes
|
185
|
-
downtime - Schedule fixed downtime for a host
|
186
|
+
downtime - Schedule fixed downtime for (a) host(s) , multiple hosts in a comma separated list
|
186
187
|
help - Shows a list of commands or help for one command
|
187
188
|
hosts - List all hosts, or detailed information about a single host
|
188
189
|
hostgroups - List hostgroups, optionally with member and service info, Usage examples:
|
@@ -236,6 +237,10 @@ And please feel free to leave bug-reports or feature requests as issues in this
|
|
236
237
|
|
237
238
|
## Version history
|
238
239
|
|
240
|
+
### 0.1.8
|
241
|
+
|
242
|
+
Option to schedule downtime of many hosts in i comma separated list from a single command.
|
243
|
+
|
239
244
|
### 0.1.7
|
240
245
|
|
241
246
|
New command 'commit' that commits any pending/unsaved changes done previously, combined with
|
data/bin/op5util
CHANGED
@@ -80,7 +80,7 @@ command :add_hostgroups do |c|
|
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
-
desc 'Schedule fixed downtime for a host'
|
83
|
+
desc 'Schedule fixed downtime for (a) host(s), multiple hosts in a comma separated list'
|
84
84
|
arg_name 'host'
|
85
85
|
command :downtime do |c|
|
86
86
|
c.desc 'Duration of downtime, in number of hours'
|
@@ -3,17 +3,24 @@
|
|
3
3
|
module Op5util
|
4
4
|
# Foo
|
5
5
|
class Monitor
|
6
|
-
|
6
|
+
|
7
|
+
def schedule_downtime(host_string, options)
|
8
|
+
host_string.split(',').each do |host|
|
9
|
+
schedule_downtime_for_host(host, options)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def schedule_downtime_for_host(host, options)
|
7
16
|
body = build_schedule_downtime_request_body(host, options)
|
8
17
|
response = self.class.post(@base_uri + 'command/SCHEDULE_HOST_DOWNTIME',
|
9
18
|
headers: { 'Content-Type' => 'application/json' },
|
10
19
|
body: body, basic_auth: @auth, verify: false)
|
11
20
|
raise ApiError unless response.code == 200
|
12
|
-
puts
|
21
|
+
puts "Downtime Scheduled for host #{host}"
|
13
22
|
end
|
14
23
|
|
15
|
-
private
|
16
|
-
|
17
24
|
def build_schedule_downtime_request_body(host, options)
|
18
25
|
start_time = Time.now.to_i + options[:wait].to_i
|
19
26
|
end_time = start_time + + options[:time].to_i * 3600 + 10
|
data/lib/op5util/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: op5util
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Niklas Paulsson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|