Class: Chef::Knife::AzureAgCreate

Inherits:
Chef::Knife show all
Includes:
AzureBase
Defined in:
lib/chef/knife/azure_ag_create.rb

Instance Method Summary collapse

Methods included from AzureBase

#fetch_chef_client_logs, #fetch_deployment, #fetch_extension, #fetch_role, #fetch_substatus, #find_file, #get_azure_profile_file_path, #get_default_subscription, included, #is_image_windows?, #msg_pair, #msg_server_summary, #parse_azure_profile, #parse_publish_settings_file, #pretty_key, #service, #validate!, #validate_asm_keys!, #validate_params!

Instance Method Details

#runObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/chef/knife/azure_ag_create.rb', line 45

def run
  $stdout.sync = true

  Chef::Log.info("validating...")
  validate_asm_keys!(:azure_affinity_group,
    :azure_service_location)

  params = {
    azure_ag_name: config[:azure_affinity_group],
    azure_ag_desc: config[:azure_ag_desc],
    azure_location: config[:azure_service_location],
  }

  rsp = service.create_affinity_group(params)
  print "\n"
  if rsp.at_css("Status").nil?
    if rsp.at_css("Code").nil? || rsp.at_css("Message").nil?
      puts "Unknown Error. try -VV"
    else
      puts "#{rsp.at_css("Code").content}: "\
           "#{rsp.at_css("Message").content}"
    end
  else
    puts "Creation status: #{rsp.at_css("Status").content}"
  end
end