Skip to content

Commit

Permalink
Merge pull request #254 from gossion/windows-stemcell-managed
Browse files Browse the repository at this point in the history
Fix the error when rendering CPI job template
  • Loading branch information
AbelHu authored Mar 17, 2017
2 parents 600816b + 11500a5 commit 9604efe
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions jobs/azure_cpi/templates/cpi.json.erb
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,14 @@
raise 'ssh_certificate has been replaced by ssh_public_key. Please read https://bosh.io/docs/azure-cpi.html.'
end

if_p('azure.windows') do
windows = p('azure.windows')
username = windows['username']
password = windows['password']
unless username.nil? && password.nil?
raise 'Both "username" and "password" must be set for Windows' if username.nil? || username.empty? || password.nil? || password.empty?
params['cloud']['properties']['azure']['windows'] = {}
if_p('azure.windows.username') do |username|
raise 'The username of Windows can not be empty' if username.empty?
params['cloud']['properties']['azure']['windows']['username'] = username
end.else do
raise 'You must provide a username for Windows'
end
if_p('azure.windows.password') do |password|
raise 'The password of Windows can not be empty' if password.empty?
params['cloud']['properties']['azure']['windows']['password'] = password
end.else do
raise 'You must provide a password for Windows'
end
params['cloud']['properties']['azure']['windows']['username'] = username
params['cloud']['properties']['azure']['windows']['password'] = password
end

if p('azure.environment') == 'AzureStack'
Expand Down

0 comments on commit 9604efe

Please sign in to comment.