[PATCH configure] BZ 803745 - Warn credentials are incorrect if authentication with RHEV fails when checking export type

Mo Morsi mmorsi at redhat.com
Tue Mar 20 14:45:10 UTC 2012


On 03/19/2012 01:51 PM, Richard Su wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=803745
>
> If credentials are incorrect, it is currently hidden behind an error message indicating the export path could not be found.
> ---
>  .../parser/functions/rhevm_validate_export_type.rb |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/recipes/aeolus/lib/puppet/parser/functions/rhevm_validate_export_type.rb b/recipes/aeolus/lib/puppet/parser/functions/rhevm_validate_export_type.rb
> index 73dd282..6aaad0c 100644
> --- a/recipes/aeolus/lib/puppet/parser/functions/rhevm_validate_export_type.rb
> +++ b/recipes/aeolus/lib/puppet/parser/functions/rhevm_validate_export_type.rb
> @@ -18,6 +18,12 @@ ENDDOC
>    curl.http_get
>    result_body = curl.body_str.to_s
>  
> +  if result_body.index("HTTP authentication")
> +    raise Puppet::ParseError, "Unable to authenticate with RHEV. Please check\
> + deltacloud_username and deltacloud_password in /etc/aeolus-configure/nodes/r\
> +hevm_configure."
> +  end
> +
>    storagedomains  = Nokogiri::XML(result_body)
>    found = storagedomains.xpath("/storage_domains/storage_domain[type=\"export\"] and /storage_domains/storage_domain/storage[path=\"#{args[4]}\"]")
>  

This works but instead of checking for the "HTTP authentication" string
in the result body you can just check curl.response_code.

I verified for successful authentications '200' is returned, but for
invalid authentications a '401 - unauthorized' response is returned.

Other than that ACK, patch does works as intended.

  -Mo



More information about the aeolus-devel mailing list