knife-maas 1.1.5 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb6991e39923bff3d624a37ee31c917eea2f850f
4
- data.tar.gz: 31e0526c31401c12c5d0a60a61ea081c6564e37e
3
+ metadata.gz: 2827197e487f6127acddd0368ac0f40de6a0b765
4
+ data.tar.gz: 61d537f16f95d92077e8ee3021674a0caae9a739
5
5
  SHA512:
6
- metadata.gz: 0adc4dc1a6dba84643b097e5808de87735c08d68804135b8a1f3de251ddd8dc70793d8bf737a3ec1ee6793ba0a0812754eaf22a013254a03adfdf18d4c1f7fc0
7
- data.tar.gz: f6662e9dbad65642d1fb6bf3e53ed9a3be125b9e886eb6bd8f8c324d9aefab3f7258916a9f01cfd252c82e1bc1767abfb1f9b66fd7bf88d98b89ebe82137a7e1
6
+ metadata.gz: 486afb9e8efbd59bf9a139250daa3d3dcb314181702503823b38266b9e8a76cc2b02a8b15ea78e5ec768a8dd589ab163c92da50657a124158c677ce0dc76b156
7
+ data.tar.gz: 73c5a70afdb4b76463177215ec4a63a2fe45a9c599cc1cf38059553094c84c733081c079b638983b108ebc9dfad422b7de5a9aaafb3837e77ed4bec64211d0b8
@@ -1,7 +1,7 @@
1
1
  class Chef
2
2
  class Knife
3
3
  module Maas
4
- VERSION = "1.1.5"
4
+ VERSION = "1.2.0"
5
5
  end
6
6
  end
7
7
  end
@@ -11,8 +11,32 @@ class Chef
11
11
 
12
12
  banner "knife maas server acquire (options)"
13
13
 
14
+ option :hostname,
15
+ :short => "-h HOSTNAME",
16
+ :long => "--hostname HOSTNAME",
17
+ :description => "The HOSTNAME inside of MAAS"
18
+
19
+ option :zone,
20
+ :short => "-Z ZONE",
21
+ :long => "--zone ZONE",
22
+ :description => "Bootstrap inside a ZONE inside of MAAS"
23
+
14
24
  def run
15
- response = access_token.request(:post, "/nodes/?op=acquire")
25
+
26
+ hostname = locate_config_value(:hostname)
27
+ zone = locate_config_value(:zone)
28
+
29
+ if (!hostname.nil? && !zone.nil?)
30
+ puts "\nPlease only use one of these options, zone or hostname"
31
+ exit 1
32
+ elsif !hostname.nil?
33
+ response = access_token.request(:post, "/nodes/", {'op'=> 'acquire','name' => "#{hostname}"})
34
+ elsif !zone.nil?
35
+ response = access_token.request(:post, "/nodes/", {'op'=> 'acquire','zone' => "#{zone}"})
36
+ else
37
+ response = access_token.request(:post, "/nodes/?op=acquire")
38
+ end
39
+
16
40
  hostname = JSON.parse(response.body)["hostname"]
17
41
  puts "Acquiring #{hostname} under your account now...."
18
42
  end
@@ -13,6 +13,11 @@ class Chef
13
13
 
14
14
  banner "knife maas server bootstrap (options)"
15
15
 
16
+ option :hostname,
17
+ :short => "-h HOSTNAME",
18
+ :long => "--hostname HOSTNAME",
19
+ :description => "The HOSTNAME inside of MAAS"
20
+
16
21
  option :template_file,
17
22
  :long => "--template-file TEMPLATE",
18
23
  :description => "Full path to location of template to use",
@@ -26,9 +31,27 @@ class Chef
26
31
  :proc => lambda { |o| o.split(/[\s,]+/) },
27
32
  :default => []
28
33
 
34
+ option :zone,
35
+ :short => "-Z ZONE",
36
+ :long => "--zone ZONE",
37
+ :description => "Bootstrap inside a ZONE inside of MAAS"
38
+
29
39
  def run
30
40
 
31
- response = access_token.request(:post, "/nodes/?op=acquire")
41
+ hostname = locate_config_value(:hostname)
42
+ zone = locate_config_value(:zone)
43
+
44
+ if (!hostname.nil? && !zone.nil?)
45
+ puts "\nPlease only use one of these options, zone or hostname"
46
+ exit 1
47
+ elsif !hostname.nil?
48
+ response = access_token.request(:post, "/nodes/", {'op'=> 'acquire','name' => "#{hostname}"})
49
+ elsif !zone.nil?
50
+ response = access_token.request(:post, "/nodes/", {'op'=> 'acquire','zone' => "#{zone}"})
51
+ else
52
+ response = access_token.request(:post, "/nodes/?op=acquire")
53
+ end
54
+
32
55
  hostname = JSON.parse(response.body)["hostname"]
33
56
  system_id = JSON.parse(response.body)["system_id"]
34
57
  system_info = access_token.request(:get, "/nodes/#{system_id}/")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-maas
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JJ Asghar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-17 00:00:00.000000000 Z
11
+ date: 2015-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef