maas-client 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +10 -0
- data/lib/maas/client.rb +12 -4
- data/lib/maas/client/cli.rb +4 -5
- data/lib/maas/client/template/rbmaas.yml +0 -1
- data/lib/maas/client/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8c5e1e49b5860c2dd08f3f54f50e4bb2e0ec0159d55f151351d382e997e3372f
|
4
|
+
data.tar.gz: 4bcf35e1650fda5b9fbb618623c63b2a2a424380bdc23bcc4c70c74385a73098
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec4cc750290fdada55ef41f463d3daf2ff3d2d42b220ad6caaf0c425f57cc4f9c8f381204657b6706877de8429fc456ff917d10a7ac307d9b647897d06883a0c
|
7
|
+
data.tar.gz: 9d51ba8ad6e5c0326ee3cec8035afcb1ac31440fc9c1e4cfec1592ab282dfffa226dd103fbfd34f6faf93776649427164be925b9f6906ecaf1421d684962b9ef
|
data/README.md
CHANGED
@@ -20,6 +20,10 @@ $ gem install maas-client --no-ri --no-rdoc
|
|
20
20
|
|
21
21
|
require "maas/client"
|
22
22
|
|
23
|
+
# when ~/.rbmaas/rbmaas.yml is configured
|
24
|
+
con = Maas::Client::MaasClient.new()
|
25
|
+
|
26
|
+
# when manually configuring
|
23
27
|
con = Maas::Client::MaasClient.new("#{CONSUMER_KEY}:#{KEY}:#{SECRET}",
|
24
28
|
"http://#{IP_OR_DOMAIN_NAME}/MAAS/api/2.0")
|
25
29
|
|
@@ -52,6 +56,12 @@ myarr
|
|
52
56
|
```bash
|
53
57
|
# to generate hosts file
|
54
58
|
rbmaas generate hosts
|
59
|
+
|
60
|
+
# to disused resources
|
61
|
+
rbmaas clear
|
62
|
+
|
63
|
+
# to initialize MAAS as defined in a yaml file
|
64
|
+
rbmaas init -f maas.yml
|
55
65
|
```
|
56
66
|
## Development and Contribution
|
57
67
|
|
data/lib/maas/client.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require 'maas/client/config'
|
2
2
|
require 'oauth'
|
3
3
|
require 'oauth/signature/plaintext'
|
4
4
|
require 'json'
|
@@ -9,12 +9,20 @@ module Maas
|
|
9
9
|
class MaasClient
|
10
10
|
attr_reader :access_token
|
11
11
|
|
12
|
-
def initialize(api_key, endpoint)
|
13
|
-
|
12
|
+
def initialize(api_key = nil, endpoint = nil)
|
13
|
+
if api_key and endpoint
|
14
|
+
@api_key = api_key
|
15
|
+
@endpoint = endpoint
|
16
|
+
elsif File.exists?(Maas::Client::Config.config[:conf_file])
|
17
|
+
Maas::Client::Config.set_config
|
18
|
+
@api_key = Maas::Client::Config.config[:maas][:key]
|
19
|
+
@endpoint = Maas::Client::Config.config[:maas][:url]
|
20
|
+
else
|
21
|
+
abort("There is no server Info provided.")
|
22
|
+
end
|
14
23
|
@consumer_key = @api_key.split(/:/)[0]
|
15
24
|
@key = @api_key.split(/:/)[1]
|
16
25
|
@secret = @api_key.split(/:/)[2]
|
17
|
-
@endpoint = endpoint
|
18
26
|
consumer = OAuth::Consumer.new(
|
19
27
|
@consumer_key,
|
20
28
|
'',
|
data/lib/maas/client/cli.rb
CHANGED
@@ -16,12 +16,11 @@ module Maas
|
|
16
16
|
|
17
17
|
no_commands do
|
18
18
|
def init_rbmaas
|
19
|
-
|
20
|
-
if File.exists?(maas_config[:conf_file])
|
19
|
+
if File.exists?(Maas::Client::Config.config[:conf_file])
|
21
20
|
Maas::Client::Config.set_config
|
22
21
|
Maas::Client::MaasClient.new(
|
23
|
-
|
24
|
-
|
22
|
+
Maas::Client::Config.config[:maas][:key],
|
23
|
+
Maas::Client::Config.config[:maas][:url]
|
25
24
|
)
|
26
25
|
else
|
27
26
|
Maas::Client::Config.init_config
|
@@ -29,7 +28,7 @@ module Maas
|
|
29
28
|
end
|
30
29
|
end
|
31
30
|
|
32
|
-
desc 'clear', "Clear
|
31
|
+
desc 'clear', "Clear disused resources."
|
33
32
|
def clear(resource)
|
34
33
|
case resource
|
35
34
|
when 'dns'
|
data/lib/maas/client/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maas-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Don Draper
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -198,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
198
198
|
version: '0'
|
199
199
|
requirements: []
|
200
200
|
rubyforge_project:
|
201
|
-
rubygems_version: 2.6
|
201
|
+
rubygems_version: 2.7.6
|
202
202
|
signing_key:
|
203
203
|
specification_version: 4
|
204
204
|
summary: A client library for MAAS
|