salt-api 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/salt/api/client.rb +5 -5
- data/lib/salt/api/configure.rb +10 -1
- data/lib/salt/api/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: 71dcf6899abe26e0fcdda86884a6fbfb120f364e
|
4
|
+
data.tar.gz: 9f1790f968992c64512ffc296d1cbf2e184cd68c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efdf214d6296aa6579d013f6d155b37463e78dec8f29755d98ac0d0052969fd48293a83a38f4a2ee5669eaea666b9cdec38ef9330b958c68a565c4b291d94a9f
|
7
|
+
data.tar.gz: 91f838cac0b226284bf18ed363f6cf00c71d6b26bec824fab367481d6ac7add29c5dec99472fd23ec552efd3d26d569c573da99b41cbda5df9dc10b73080cd47
|
data/lib/salt/api/client.rb
CHANGED
@@ -5,19 +5,19 @@ module Salt
|
|
5
5
|
module Api
|
6
6
|
module Client
|
7
7
|
def client
|
8
|
-
Net::HTTP.new(hostname,
|
9
|
-
client.use_ssl =
|
8
|
+
Net::HTTP.new(hostname, port).tap do |client|
|
9
|
+
client.use_ssl = use_ssl
|
10
10
|
client.open_timeout = timeout
|
11
11
|
# TODO: Allow specifying CA and such
|
12
12
|
client.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
def login
|
16
|
+
def login
|
17
17
|
req = Net::HTTP::Post.new("/login")
|
18
18
|
req.set_form_data({
|
19
19
|
'eauth' => 'pam',
|
20
|
-
'username' =>
|
20
|
+
'username' => username,
|
21
21
|
'password' => password
|
22
22
|
})
|
23
23
|
req['Accept'] = "application/x-yaml"
|
@@ -29,7 +29,7 @@ module Salt
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def token
|
32
|
-
@token ||= login
|
32
|
+
@token ||= login["token"]
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
data/lib/salt/api/configure.rb
CHANGED
@@ -5,12 +5,21 @@ module Salt
|
|
5
5
|
:hostname,
|
6
6
|
:username,
|
7
7
|
:password,
|
8
|
-
:timeout
|
8
|
+
:timeout,
|
9
|
+
:port,
|
10
|
+
:use_ssl
|
9
11
|
].freeze
|
10
12
|
|
11
13
|
attr_accessor *VALID_OPTION_KEYS
|
12
14
|
|
15
|
+
def set_defaults
|
16
|
+
@hostname = "salt"
|
17
|
+
@port = 8000
|
18
|
+
@use_ssl = true
|
19
|
+
end
|
20
|
+
|
13
21
|
def configure
|
22
|
+
set_defaults
|
14
23
|
yield self
|
15
24
|
end
|
16
25
|
end
|
data/lib/salt/api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: salt-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua B. Bussdieker
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|