ACK

Test output below:

>> ./bin/deltacloudc images index -U <username with @ > -P <password> -u 
>> http://localhost:3004/api 
53f70a9e-2 | 0177a2f0-ef7e-4c1c-a | x86_64 | Template by iwhd     |  <username>
...
6867beb2-f | 69eda91e-f390-486e-8 | x86_64 | Template by iwhd     |  <username>

>> ./bin/deltacloudc images index -U <username> -P <password with special 
>> character> -u http://localhost:3006/api 
factory-im | factory-image-01f5c7 | x86_64 | Other Linux (64-bit) |   <username>
...
tI2        | tI2                  | x86_64 | Other Linux (64-bit) |   <username>

----- Original Message -----
> From: [email protected]
> To: [email protected]
> Sent: Thursday, April 12, 2012 5:39:21 AM
> Subject: [PATCH core] Client: Added --user and --password parameters to 
> Deltacloud cmd client (DTACLOUD-141)
> 
> From: Michal Fojtik <[email protected]>
> 
> This change is needed because some cloud cloud providers use special
> characters in API keys. Those were not properly escaped and thus
> handled
> incorrectly by URI.parse. This caused 401 in most cases.
> 
> Signed-off-by: Michal fojtik <[email protected]>
> ---
>  client/bin/deltacloudc |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/client/bin/deltacloudc b/client/bin/deltacloudc
> index 40fabcd..a6bff13 100755
> --- a/client/bin/deltacloudc
> +++ b/client/bin/deltacloudc
> @@ -65,6 +65,8 @@ BANNER
>    opts.on( '-n', '--name NAME', 'Name (for instance eg.)') { |name|
>    options[:name] = name }
>    opts.on( '-s', '--state STATE', 'Instance state (RUNNING,
>    STOPPED)') { |state| options[:state] = state }
>    opts.on( '-u', '--url URL', 'API url ($API_URL variable)') { |url|
>    options[:api_url] = url }
> +  opts.on( '-U', '--user USER', 'API username ($API_USERNAME
> variable)') { |u| options[:api_user] = u }
> +  opts.on( '-P', '--password PASSWORD', 'API password ($API_PASSWORD
> variable)') { |p| options[:api_password] = p }
>    opts.on( '-l', '--list', 'List collections/operations') { |id|
>    options[:list] = true }
>    opts.on( '-h', '--help', 'Display this screen' ) { puts @optparse;
>    Kernel.exit! }
>    opts.on( '-v', '--version', 'Display API version' ) {
>    options[:version]=true }
> @@ -104,7 +106,7 @@ options[:collection] = ARGV[0]
>  options[:operation] = ARGV[1]
>  
>  # Connect to Deltacloud API and fetch all entry points
> -client = DeltaCloud.new(url.user || ENV['API_USER'], url.password ||
> ENV['API_PASSWORD'], api_url)
> +client = DeltaCloud.new(options[:api_user] || ENV['API_USER'],
> options[:api_password] || ENV['API_PASSWORD'], api_url)
>  collections = client.entry_points.keys
>  
>  # Exclude collection which don't have methods in client library yet
> --
> 1.7.10
> 
> 

Reply via email to