hinoki 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -2
- data/lib/hinoki/base.rb +2 -2
- data/lib/hinoki/config.rb +3 -1
- data/lib/hinoki/connection.rb +11 -6
- data/lib/hinoki/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1aabb20bcfa898e0fa04fb24857ab8e96519a8b
|
4
|
+
data.tar.gz: b359fa720ef72c4c9e9f6f795e3fd8940fc06fc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a5dddd278c78f6087820f84f05445cf97b09d7903c53128ea8dafb1f33ea35051ce72d8f188f62aed47779ba64e8c7d13be7d8dbfa012cc0bedba1f7287ee94
|
7
|
+
data.tar.gz: 615ceb2fb75c24f49ecdf0afd21a25422d7981aaa0787fcc8ca1e7484250ee40b30b95269aa5f0bae7c33faa7724cc633a2bc301ff808c87914d97e408564b2a
|
data/README.md
CHANGED
@@ -12,8 +12,12 @@ same terminology is used across endpoints.
|
|
12
12
|
### Configuration
|
13
13
|
Hinoki looks for a config file in `~/.hinoki`. If it does not find this
|
14
14
|
configuration file, it will assume it should contact `localhost:4567` for all
|
15
|
-
requests. The config file is JSON format and accepts
|
16
|
-
|
15
|
+
requests. The config file is JSON format and accepts the following parameters:
|
16
|
+
|
17
|
+
* `host` - Host of the Sensu API
|
18
|
+
* `port` - Port of the Sensu API
|
19
|
+
* `user` - HTTP basic auth username
|
20
|
+
* `password` - HTTP basic auth password
|
17
21
|
|
18
22
|
``` json
|
19
23
|
{
|
data/lib/hinoki/base.rb
CHANGED
@@ -10,8 +10,8 @@ require 'hinoki/stashes'
|
|
10
10
|
class Hinoki
|
11
11
|
attr_accessor(:aggregates, :clients, :checks, :events, :stashes)
|
12
12
|
|
13
|
-
def initialize(host=nil, port=nil)
|
14
|
-
@@conn = Hinoki::Connection.new(host, port)
|
13
|
+
def initialize(host=nil, port=nil, user=nil, pass=nil)
|
14
|
+
@@conn = Hinoki::Connection.new(host, port, user, pass)
|
15
15
|
@aggregates = Hinoki::Aggregates
|
16
16
|
@checks = Hinoki::Checks
|
17
17
|
@clients = Hinoki::Clients
|
data/lib/hinoki/config.rb
CHANGED
@@ -4,12 +4,14 @@ require 'json'
|
|
4
4
|
|
5
5
|
class Hinoki
|
6
6
|
class Config
|
7
|
-
attr_accessor(:host, :port)
|
7
|
+
attr_accessor(:host, :port, :user, :pass)
|
8
8
|
|
9
9
|
def initialize
|
10
10
|
@config = parse_config_file
|
11
11
|
@host = @config['host']
|
12
12
|
@port = @config['port']
|
13
|
+
@user = @config['user']
|
14
|
+
@pass = @config['password']
|
13
15
|
end
|
14
16
|
|
15
17
|
private
|
data/lib/hinoki/connection.rb
CHANGED
@@ -7,30 +7,35 @@ require 'hinoki/config'
|
|
7
7
|
class Hinoki
|
8
8
|
class Connection
|
9
9
|
|
10
|
-
def initialize(host=nil, port=nil)
|
10
|
+
def initialize(host=nil, port=nil, user=nil, pass=nil)
|
11
11
|
@config = Hinoki::Config.new
|
12
|
+
@config.user = user if user
|
13
|
+
@config.pass = pass if pass
|
12
14
|
@http = Net::HTTP.new(host || @config.host, port || @config.port)
|
13
15
|
end
|
14
16
|
|
15
17
|
# Wrapper around Net::HTTP.get
|
16
18
|
def get(path)
|
17
|
-
|
19
|
+
request(Net::HTTP::Get.new(path))
|
18
20
|
end
|
19
21
|
|
20
22
|
# Wrapper around Net::HTTP.post
|
21
23
|
def post(path)
|
22
|
-
|
24
|
+
request(Net::HTTP::Post.new(path))
|
23
25
|
end
|
24
|
-
|
26
|
+
|
25
27
|
# Wrapper around Net::HTTP.delete
|
26
28
|
def delete(path)
|
27
|
-
|
29
|
+
request(Net::HTTP::Delete.new(path))
|
28
30
|
end
|
29
31
|
|
30
32
|
def request(req)
|
33
|
+
if @config.user && @config.pass
|
34
|
+
req.basic_auth(@config.user, @config.pass)
|
35
|
+
end
|
31
36
|
return interpret_response(@http.request(req))
|
32
37
|
end
|
33
|
-
|
38
|
+
|
34
39
|
private
|
35
40
|
|
36
41
|
# Helper to basically handle any repsonse we could get.
|
data/lib/hinoki/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hinoki
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jake Davis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A programmatic CLI utility for interacting with the Sensu API
|
14
14
|
email: jake.davis5989@gmail.com
|
@@ -49,7 +49,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
49
49
|
version: '0'
|
50
50
|
requirements: []
|
51
51
|
rubyforge_project:
|
52
|
-
rubygems_version: 2.2.
|
52
|
+
rubygems_version: 2.2.2
|
53
53
|
signing_key:
|
54
54
|
specification_version: 4
|
55
55
|
summary: Sensu CLI utility
|