Thanks for the response, but even using that syntax, asking for
multiple password_prompts still only asks for the first one and
continues on with all other set statements unexecuted. Is this a
Highline bug?
Tony
On May 10, 2:19 pm, Jamis Buck <[EMAIL PROTECTED]> wrote:
> Tony,
>
> Note that when you set a variable to a proc value, the value does not
> get evaluated immediately--rather, it gets evaluated the first time
> the variable is referenced. What you probably want is just this:
>
> set :password, Capistrano::CLI.password_prompt("...")
> set :intranet_login, Capistrano::CLI.password_prompt("...")
> set :intranet_password, Capistrano::CLI.password_prompt("...")
>
> Also, note that when setting a proc-valued variable, the preferred
> syntax is this:
>
> set(:password) { ... }
>
> Using the proc keyword, or even Proc.new, is just ugly, IMO. :) Avoid
> it whenever you can.
>
> - Jamis
>
> On May 10, 2008, at 1:52 PM, Tony Perrie wrote:
>
>
>
> > I have a strange security requirement from a client where I can't
> > store several passwords on our shared SCM server. As such, I tried
> > asking for multiple passwords (two or more) in a deploy.rb using the
> > following task.
>
> > namespace :pre_setup do
> > task :generate_database_configuration, :roles => :app do
> > set :password, proc { Capistrano::CLI.password_prompt("MySQL
> > Password (#{application}): ")}
> > set :intranet_login, proc
> > { Capistrano::CLI.password_prompt("Intranet Login (#{application}):
> > ")}
> > set :intranet_password, proc
> > { Capistrano::CLI.password_prompt("Intranet Password (#{application}):
> > ")}
> > # ...
> > end
> > end
>
> > The problem is, Capistrano only asks for the first password. I've
> > already tried every variant on the set command that I could find after
> > Googling around for about an hour.
>
> > This doesn't work either:
>
> > set(:password) { Capistrano::CLI.password_prompt("MySQL Password
> > (#{application}): ")}
> > set(:intranet_login) { Capistrano::CLI.password_prompt("Intranet
> > Login (#{application}): ")}
> > set(:intranet_password)
> > { Capistrano::CLI.password_prompt("Intranet Password (#{application}):
> > ")}
>
> > Neither does this:
>
> > set :password, Proc.new { Capistrano::CLI.password_prompt("MySQL
> > Password (#{application}): ")}
> > set :intranet_login, Proc.new
> > { Capistrano::CLI.password_prompt("Intranet Login (#{application}):
> > ")}
> > set :intranet_password, Proc.new
> > { Capistrano::CLI.password_prompt("Intranet Password (#{application}):
> > ")}
>
> > The only way I was able to get Capistrano to ask for multiple
> > passwords was doing the following:
>
> > set :password, proc { Capistrano::CLI.password_prompt("MySQL
> > Password (#{application}): ")}
> > sleep 1 unless password.length > 0
> > set :intranet_login, proc
> > { Capistrano::CLI.password_prompt("Intranet Login (#{application}):
> > ")}
> > sleep 1 unless intranet_login.length > 0
> > set :intranet_password, proc
> > { Capistrano::CLI.password_prompt("Intranet Password (#{application}):
> > ")}
> > sleep 1 unless intranet_password.length > 0
>
> > I have to believe this is either a bug with Capistrano, Highline or
> > Termios.
>
> > Any suggestions?
>
> > Tony
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---