Skip to content

Commit 0a6cc01

Browse files
Merge pull request #609 from JustAnotherArchivist/bot-check-pipeline-option
Verify that there is a suitable running pipeline when --pipeline/-p is used
2 parents 050c783 + 605022a commit 0a6cc01

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

bot/brain.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
require File.expand_path('../../lib/job', __FILE__)
44
require File.expand_path('../../lib/pipeline_info', __FILE__)
5+
require File.expand_path('../../lib/pipeline_collection', __FILE__)
56
require File.expand_path('../summary', __FILE__)
67
require File.expand_path('../post_registration_hook', __FILE__)
78
require File.expand_path('../add_ignore_sets', __FILE__)
@@ -90,6 +91,14 @@ def request_archive(m, target, params, depth=:inf, url_file=false)
9091
return
9192
end
9293

94+
# Is there any suitable running --pipeline?
95+
if h[:pipeline]
96+
if !PipelineCollection.new(redis).any? { |pipeline| pipeline['nickname'].include?(h[:pipeline]) && pipeline['status'] == 'Running' }
97+
reply m, "Sorry, there is no running pipeline that matches --pipeline #{h[:pipeline]}."
98+
return
99+
end
100+
end
101+
93102
# Is the URI in our list of recognized schemes?
94103
if !schemes.include?(uri.scheme)
95104
reply m, "Sorry, I can only handle #{schemes.join(', ')}."

0 commit comments

Comments
 (0)