knife-azure 1.2.2 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZDQzMDFlNGVlNjhlMDYwOTgwZmEyMDM4NmU4MmZlNTQzMWJiN2QyMQ==
4
+ NWQxYTRjNmM1YmEwZmU2M2E1Y2M3NGU2YzkzNzIyNTE4OTFkMzQwOQ==
5
5
  data.tar.gz: !binary |-
6
- OGJiOGY0Y2U5YTBlODhmMzg0NTlhNjVlMDMxNDgzZGVmZDZlNWJlZQ==
6
+ MGFhNjQxYTFmZjVjMjFkODZiZGI4NDY2ZGFjOWYyMDFlNTNkOTI0ZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ODA2ZDZjYTE0YTMwMGEzNmQyZTRiMWE0MDA3ZjdkNDAyNTA1ZDNjOTI3Mzlj
10
- MzBjMmE0NzBmNDczNTQ5M2Q1YTFlYmZkYjkwODc5Y2JhOTc4N2VmMjNjMjM2
11
- ZTc4NDJiYTg2NjIxODU5NWY0OGZjYTBlYjYxZjMyOTJlNTdjMTI=
9
+ MmZmM2Q0ZTIwODUxZTRiN2FlNmY5ZjFlZmUxMGFlZDFkMjhiODhhYjBkYmY0
10
+ MGVlYzA5NjdkNmZhMTY0ZDY2N2E1ODU3M2M4NzAwYjFiMDlmY2Q2ZDM1YjQ0
11
+ MzlkNjBjOWZiNGUxNTg1ZGE4ZDRmODcxNzRjODMyNTYyODcwOTQ=
12
12
  data.tar.gz: !binary |-
13
- NjU3OTY3YzQ4NTRhY2JiYjFmYjlhYTk5OWMyYTE2MDFkMWVlOTUxYWU0MDcz
14
- ZDRhOGUzOGNmYjlkM2FmNGY4OWJlMDE4OTQ1M2M3YjU2MWQwYTY2MzBiMzhh
15
- ZjlkYTViZGQ5MDZmZDI1Y2E2OWViNGE0MDE2ODMwMDRjNDc2Yjk=
13
+ NTZhYmViMTFhNDk1N2RiZTE0OTk2NzIzZDU3YjQ4YTQ0NGRlZTc3MjhmNTdm
14
+ NTVjMDZlOTNjMjJmYTYxZTcyNGU4MzVhY2UxMTUyYjgyOTc4YmViZjdiY2Yx
15
+ OTgxZGJkYmRlZDhlZTdhODliNGQ4ZGZhMTY0NzhiOWYyM2JlZTE=
data/README.md CHANGED
@@ -51,7 +51,7 @@ location in your knife.rb:
51
51
  $ knife azure server create -N MyNewNode --azure-vm-size Medium --I 8fcc3d_Ubuntu-12_04-amd64-30GB -m 'West US' --ssh-user myuser --identity-file ~/.ssh/myprivatekey_rsa
52
52
 
53
53
  # Create and bootstrap a Windows VM over winrm
54
- $ knife azure server create --azure-dns-name MyNewServerName --azure-vm-size Medium --I 8fcc3d_Win2012-amd64-30GB -m 'West US' --winrm-user myuser --winrm-password 'mypassword' --bootstrap-protocol winrm --distro 'windows-chef-client-msi'
54
+ $ knife azure server create --azure-dns-name MyNewServerName --azure-vm-size Medium --azure-source-image 8fcc3d_Win2012-amd64-30GB --azure-service-location 'West US' --winrm-user myuser --winrm-password 'mypassword' --bootstrap-protocol winrm --distro 'windows-chef-client-msi'
55
55
 
56
56
  # Delete a server and purge it from the Chef server
57
57
  $ knife azure server delete MyNewNode --purge -y
@@ -207,6 +207,12 @@ class Chef
207
207
  Chef::Config[:knife][:hints][name] = path ? JSON.parse(::File.read(path)) : Hash.new
208
208
  }
209
209
 
210
+ option :json_attributes,
211
+ :short => "-j JSON",
212
+ :long => "--json-attributes JSON",
213
+ :description => "A JSON string to be added to the first run of chef-client",
214
+ :proc => lambda { |o| JSON.parse(o) }
215
+
210
216
  def strip_non_ascii(string)
211
217
  string.gsub(/[^0-9a-z ]/i, '')
212
218
  end
@@ -346,8 +352,7 @@ class Chef
346
352
  if connection.hosts.exists?(locate_config_value(:azure_dns_name))
347
353
  remove_hosted_service_on_failure = nil
348
354
  end
349
- remove_storage_service_on_failure = locate_config_value(:azure_storage_account)
350
-
355
+
351
356
  #If Storage Account is not specified, check if the geographic location has one to re-use
352
357
  if not locate_config_value(:azure_storage_account)
353
358
  storage_accts = connection.storageaccounts.all
@@ -359,6 +364,12 @@ class Chef
359
364
  remove_storage_service_on_failure = nil
360
365
  config[:azure_storage_account] = storage.name.to_s
361
366
  end
367
+ else
368
+ if connection.storageaccounts.exists?(locate_config_value(:azure_storage_account))
369
+ remove_storage_service_on_failure = nil
370
+ else
371
+ remove_storage_service_on_failure = locate_config_value(:azure_storage_account)
372
+ end
362
373
  end
363
374
 
364
375
  begin
@@ -442,6 +453,7 @@ class Chef
442
453
 
443
454
  bootstrap.config[:run_list] = config[:run_list]
444
455
  bootstrap.config[:prerelease] = config[:prerelease]
456
+ bootstrap.config[:first_boot_attributes] = locate_config_value(:json_attributes) || {}
445
457
  bootstrap.config[:bootstrap_version] = locate_config_value(:bootstrap_version)
446
458
  bootstrap.config[:distro] = locate_config_value(:distro)
447
459
  bootstrap.config[:template_file] = locate_config_value(:template_file)
@@ -487,28 +499,20 @@ class Chef
487
499
  def bootstrap_for_node(server,fqdn,port)
488
500
  bootstrap = Chef::Knife::Bootstrap.new
489
501
  bootstrap.name_args = [fqdn]
490
- bootstrap.config[:run_list] = config[:run_list]
491
502
  bootstrap.config[:ssh_user] = locate_config_value(:ssh_user)
492
503
  bootstrap.config[:ssh_password] = locate_config_value(:ssh_password)
493
504
  bootstrap.config[:ssh_port] = port
494
505
  bootstrap.config[:identity_file] = locate_config_value(:identity_file)
495
506
  bootstrap.config[:chef_node_name] = locate_config_value(:chef_node_name) || server.name
496
- bootstrap.config[:prerelease] = locate_config_value(:prerelease)
497
- bootstrap.config[:bootstrap_version] = locate_config_value(:bootstrap_version)
498
- bootstrap.config[:distro] = locate_config_value(:distro)
499
507
  bootstrap.config[:use_sudo] = true unless locate_config_value(:ssh_user) == 'root'
500
508
  bootstrap.config[:use_sudo_password] = true if bootstrap.config[:use_sudo]
501
- bootstrap.config[:template_file] = config[:template_file]
502
509
  bootstrap.config[:environment] = locate_config_value(:environment)
503
510
  # may be needed for vpc_mode
504
511
  bootstrap.config[:host_key_verify] = config[:host_key_verify]
505
512
  bootstrap.config[:secret] = locate_config_value(:secret)
506
513
  bootstrap.config[:secret_file] = locate_config_value(:secret_file)
507
514
 
508
- # Load cloud attributes.
509
- load_cloud_attributes_in_hints(server)
510
-
511
- bootstrap
515
+ bootstrap_common_params(bootstrap, server)
512
516
  end
513
517
 
514
518
  def validate!
@@ -602,11 +606,16 @@ class Chef
602
606
  end
603
607
 
604
608
  def cleanup_and_exit(remove_hosted_service_on_failure, remove_storage_service_on_failure)
609
+ ui.warn("Cleaning up resources...")
610
+
605
611
  if remove_hosted_service_on_failure
606
- connection.hosts.delete(remove_hosted_service_on_failure)
612
+ ret_val = connection.hosts.delete(remove_hosted_service_on_failure)
613
+ ret_val.content.empty? ? ui.warn("Deleted created DNS: #{remove_hosted_service_on_failure}.") : ui.warn("Deletion failed for created DNS:#{remove_hosted_service_on_failure}. " + ret_val.text)
607
614
  end
615
+
608
616
  if remove_storage_service_on_failure
609
- connection.storageaccounts.delete(remove_storage_service_on_failure)
617
+ ret_val = connection.storageaccounts.delete(remove_storage_service_on_failure)
618
+ ret_val.content.empty? ? ui.warn("Deleted created Storage Account: #{remove_storage_service_on_failure}.") : ui.warn("Deletion failed for created Storage Account: #{remove_storage_service_on_failure}. " + ret_val.text)
610
619
  end
611
620
  exit 1
612
621
  end
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Azure
3
- VERSION = "1.2.2"
3
+ VERSION = "1.3.0"
4
4
  MAJOR, MINOR, TINY = VERSION.split('.')
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-azure
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Barry Davis
@@ -9,64 +9,8 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-07 00:00:00.000000000 Z
12
+ date: 2014-07-31 00:00:00.000000000 Z
13
13
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: rdoc
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - ~>
19
- - !ruby/object:Gem::Version
20
- version: '3.12'
21
- type: :runtime
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ~>
26
- - !ruby/object:Gem::Version
27
- version: '3.12'
28
- - !ruby/object:Gem::Dependency
29
- name: bundler
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - ! '>='
33
- - !ruby/object:Gem::Version
34
- version: '0'
35
- type: :runtime
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ! '>='
40
- - !ruby/object:Gem::Version
41
- version: '0'
42
- - !ruby/object:Gem::Dependency
43
- name: rubygems-bundler
44
- requirement: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - ~>
47
- - !ruby/object:Gem::Version
48
- version: 1.0.3
49
- type: :runtime
50
- prerelease: false
51
- version_requirements: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - ~>
54
- - !ruby/object:Gem::Version
55
- version: 1.0.3
56
- - !ruby/object:Gem::Dependency
57
- name: equivalent-xml
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - ~>
61
- - !ruby/object:Gem::Version
62
- version: 0.2.9
63
- type: :runtime
64
- prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - ~>
68
- - !ruby/object:Gem::Version
69
- version: 0.2.9
70
14
  - !ruby/object:Gem::Dependency
71
15
  name: nokogiri
72
16
  requirement: !ruby/object:Gem::Requirement
@@ -123,6 +67,20 @@ dependencies:
123
67
  - - ~>
124
68
  - !ruby/object:Gem::Version
125
69
  version: '2.0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: equivalent-xml
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ version: 0.2.9
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ~>
82
+ - !ruby/object:Gem::Version
83
+ version: 0.2.9
126
84
  description: A plugin to the Chef knife tool for creating instances on the Microsoft
127
85
  Azure platform
128
86
  email: oss@getchef.com