One task with multiple "ask()" not triggering it more then once

12 views
Skip to first unread message

gonace

unread,
Mar 31, 2014, 9:32:56 AM3/31/14
to capis...@googlegroups.com
One task with multiple "ask()" not triggering it more then once

  task :confirmation do
    if fetch(:stage) == :production then
      puts <<-WARN

      ========================================================================

      WARNING: You're about to perform actions on production server(s)
      Please confirm that all your intentions are kind and friendly

      ========================================================================

      WARN

      ask(:answer, ' Are you sure you want to continue? (Y) ')
      if fetch(:answer) == 'Y' then
        set :confirmed, true
      end

      unless fetch(:confirmed)
        puts "\nDeploy cancelled!"
        exit
      end
    end


    if fetch(:stage) != :test then
      puts <<-WARN

      ========================================================================

      GATEWAY: You're about to perform actions on a server(s)
      that need you to provide gateway credentials.

      ========================================================================

      WARN

      gateway_username = ''
      gateway_password = ''

      ask(gateway_username, ' Username: ')
      ask(gateway_password, ' Password: ')
    end
  end
  before :starting, :confirmation


I want to ask the user for gateway credentials (username and password) but also warn about entering a task sequence to a production environment.

But only the first "ask()" is triggered, no question about username or password is asked the user.

Donovan Bray

unread,
Mar 31, 2014, 11:21:17 AM3/31/14
to capis...@googlegroups.com
Yor follow up invocations are using variables set to empty strings, you missed the leading colon to make them symbols. 
--
You received this message because you are subscribed to the Google Groups "Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capistrano+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/capistrano/b5c9010b-c059-4380-9418-0b42e323ea67%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages