Bug #18002

When creating new VM on Openstack, the availability_zone parameter should be deleted if empty ("no preference")

Added by Imri Zvik over 1 year ago.

Status:New
Priority:Normal
Assigned To:Imri Zvik
Category:Compute resources - OpenStack
Target version:-
Difficulty:trivial Bugzilla link:
Found in release:1.13.3 Pull request:
Story points-
Velocity based estimate-

Description

In Liberty, choosing "No preference" results the following error:
2017-01-10 05:01:15 fa056689 [app] [W] Failed to create a compute CR_Openstack (OpenStack) instance new-host-test: Invalid input for field/attribute availability_zone. Value: . u'' is too short | | RuntimeError: Invalid input for field/attribute availability_zone. Value: . u'' is too short | /usr/share/foreman/app/models/compute_resources/foreman/model/openstack.rb:139:in `rescue in create_vm' | /usr/share/foreman/app/models/compute_resources/foreman/model/openstack.rb:122:in `create_vm'

The solution is quite simple - something along the lines of:
args.delete(:availability_zone) if args[:availability_zone].empty?

We will open a PR for this

Also available in: Atom PDF