[PATCH conductor] BZ-788547 Unhandled exception or status code , when launching with space in deployments name for RHEV
Jozef Zigmund
jzigmund at redhat.com
Tue Feb 28 14:45:57 UTC 2012
On Tuesday 28 February 2012 13:13:54 Tomáš Hrčka wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=788547
>
> added before save hook to replace spaces with "-" in Deployment.
> ---
> src/app/models/deployment.rb | 7 +++++--
> 1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/src/app/models/deployment.rb b/src/app/models/deployment.rb
> index a0bdcd9..ec66fdb 100644
> --- a/src/app/models/deployment.rb
> +++ b/src/app/models/deployment.rb
> @@ -67,11 +67,10 @@ class Deployment < ActiveRecord::Base
> validates_length_of :name, :maximum => 50
> validates_presence_of :owner_id
> validate :pool_must_be_enabled
> -
> before_destroy :destroyable?
> before_create :inject_launch_parameters
> before_create :generate_uuid
> -
> + before_save :replace_special_characters_in_name
> USER_MUTABLE_ATTRS = ['name']
> STATE_MIXED = "mixed"
>
> @@ -593,4 +592,8 @@ class Deployment < ActiveRecord::Base
> def generate_uuid
> self[:uuid] = UUIDTools::UUID.timestamp_create.to_s
> end
> +
> + def replace_special_characters_in_name
> + name.gsub!(/[^a-zA-Z0-9]+/, '-')
> + end
> end
Works for me, ACK.
More information about the aeolus-devel
mailing list