Collect errors in setup rake task (#33603)
This commit is contained in:
		
							parent
							
								
									0aa9bb8130
								
							
						
					
					
						commit
						69b8a0b9bf
					
				@ -17,7 +17,7 @@ namespace :mastodon do
 | 
				
			|||||||
    ENV.delete('SIDEKIQ_REDIS_URL')
 | 
					    ENV.delete('SIDEKIQ_REDIS_URL')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    begin
 | 
					    begin
 | 
				
			||||||
      errors = false
 | 
					      errors = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      prompt.say('Your instance is identified by its domain name. Changing it afterward will break things.')
 | 
					      prompt.say('Your instance is identified by its domain name. Changing it afterward will break things.')
 | 
				
			||||||
      env['LOCAL_DOMAIN'] = prompt.ask('Domain name:') do |q|
 | 
					      env['LOCAL_DOMAIN'] = prompt.ask('Domain name:') do |q|
 | 
				
			||||||
@ -109,7 +109,7 @@ namespace :mastodon do
 | 
				
			|||||||
          unless prompt.yes?('Try again?')
 | 
					          unless prompt.yes?('Try again?')
 | 
				
			||||||
            return prompt.warn 'Nothing saved. Bye!' unless prompt.yes?('Continue anyway?')
 | 
					            return prompt.warn 'Nothing saved. Bye!' unless prompt.yes?('Continue anyway?')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            errors = true
 | 
					            errors << 'Database connection could not be established.'
 | 
				
			||||||
            break
 | 
					            break
 | 
				
			||||||
          end
 | 
					          end
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
@ -155,7 +155,7 @@ namespace :mastodon do
 | 
				
			|||||||
          unless prompt.yes?('Try again?')
 | 
					          unless prompt.yes?('Try again?')
 | 
				
			||||||
            return prompt.warn 'Nothing saved. Bye!' unless prompt.yes?('Continue anyway?')
 | 
					            return prompt.warn 'Nothing saved. Bye!' unless prompt.yes?('Continue anyway?')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            errors = true
 | 
					            errors << 'Redis connection could not be established.'
 | 
				
			||||||
            break
 | 
					            break
 | 
				
			||||||
          end
 | 
					          end
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
@ -450,7 +450,7 @@ namespace :mastodon do
 | 
				
			|||||||
          unless prompt.yes?('Try again?')
 | 
					          unless prompt.yes?('Try again?')
 | 
				
			||||||
            return prompt.warn 'Nothing saved. Bye!' unless prompt.yes?('Continue anyway?')
 | 
					            return prompt.warn 'Nothing saved. Bye!' unless prompt.yes?('Continue anyway?')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            errors = true
 | 
					            errors << 'E-email was not sent successfully.'
 | 
				
			||||||
            break
 | 
					            break
 | 
				
			||||||
          end
 | 
					          end
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
@ -498,7 +498,7 @@ namespace :mastodon do
 | 
				
			|||||||
            prompt.ok 'Done!'
 | 
					            prompt.ok 'Done!'
 | 
				
			||||||
          else
 | 
					          else
 | 
				
			||||||
            prompt.error 'That failed! Perhaps your configuration is not right'
 | 
					            prompt.error 'That failed! Perhaps your configuration is not right'
 | 
				
			||||||
            errors = true
 | 
					            errors << 'Preparing the database failed'
 | 
				
			||||||
          end
 | 
					          end
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -515,14 +515,15 @@ namespace :mastodon do
 | 
				
			|||||||
              prompt.say 'Done!'
 | 
					              prompt.say 'Done!'
 | 
				
			||||||
            else
 | 
					            else
 | 
				
			||||||
              prompt.error 'That failed! Maybe you need swap space?'
 | 
					              prompt.error 'That failed! Maybe you need swap space?'
 | 
				
			||||||
              errors = true
 | 
					              errors << 'Compiling assets failed.'
 | 
				
			||||||
            end
 | 
					            end
 | 
				
			||||||
          end
 | 
					          end
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        prompt.say "\n"
 | 
					        prompt.say "\n"
 | 
				
			||||||
        if errors
 | 
					        if errors.any?
 | 
				
			||||||
          prompt.warn 'Your Mastodon server is set up, but there were some errors along the way, you may have to fix them.'
 | 
					          prompt.warn 'Your Mastodon server is set up, but there were some errors along the way, you may have to fix them:'
 | 
				
			||||||
 | 
					          errors.each { |error| prompt.warn "- #{error}" }
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
          prompt.ok 'All done! You can now power on the Mastodon server 🐘'
 | 
					          prompt.ok 'All done! You can now power on the Mastodon server 🐘'
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user