Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ def create(instance, stemcell_cid, cloud_properties, network_settings, disks, en
end

password = env.fetch('bosh', {}).fetch('password', "")
if Config.generate_vm_passwords && password == ""
if !cloud_properties.dig('vcap_password').nil?
env['bosh'] ||= {}
env['bosh']['password'] = cloud_properties['vcap_password']
elsif Config.generate_vm_passwords && password == ""
env['bosh'] ||= {}
env['bosh']['password'] = sha512_hashed_password
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,28 @@ module Steps
subject.perform(report)
end
end

context 'password is specified in cloud_properties' do
let(:custom_cloud_properties) do
{
'ram' => '4gb',
'disk' => '20gb',
'vcap_password' => 'foo123'
}
end

before do
allow(instance).to receive(:cloud_properties).and_return(custom_cloud_properties)
end

it 'calls perform with custom cloud_properties' do
expect(cloud_wrapper).to receive(:create_vm) do |_, _, _, _, _, env|
expect(env['bosh']['password']).to eq('foo123')
end.and_return(create_vm_response)

subject.perform(report)
end
end
end

context 'Config.generate_vm_passwords flag is false' do
Expand Down