aboutsummaryrefslogtreecommitdiff
path: root/ag
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-02-23 18:46:44 -0800
committerRobin H. Johnson <robbat2@gentoo.org>2015-02-23 18:46:44 -0800
commit2f5ae0b2e329ee78b940c7a25e7f45b3bb09d2cd (patch)
tree8315d20ffdfe2defd0c7135364eda21da207ed23 /ag
parentLeave a note about reindex. (diff)
downloadbackend-2f5ae0b2e329ee78b940c7a25e7f45b3bb09d2cd.tar.gz
backend-2f5ae0b2e329ee78b940c7a25e7f45b3bb09d2cd.tar.bz2
backend-2f5ae0b2e329ee78b940c7a25e7f45b3bb09d2cd.zip
Prepare real wait for status.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Diffstat (limited to 'ag')
-rwxr-xr-xag17
1 files changed, 17 insertions, 0 deletions
diff --git a/ag b/ag
index 96e3195..52e8848 100755
--- a/ag
+++ b/ag
@@ -51,6 +51,13 @@ op = OptionParser.new do |opts|
$options.action = :do_delete_msg
end
+
+ opts.on('--create-index', 'Create index but do not populate. Needs --list') do
+ abort 'Can only select one action' if $options.action != nil
+
+ $options.action = :do_create_index
+ $options.need_argument = false
+ end
opts.on('--delete-index', 'Delete index. Needs --list') do
abort 'Can only select one action' if $options.action != nil
@@ -140,6 +147,11 @@ Ag::Utils.proc_count = $options.jobs
def do_full
abort "Wrong argument type: #{$options.argmode.to_s}" unless $options.argmode == :dir
+ begin
+ Ag::Storage.delete_index(list)
+ rescue Elasticsearch::Transport::Transport::Errors::NotFound => e
+ $stderr.puts "Index did not exist yet. Creating." if $options.debug
+ end
Ag::Storage.create_index($options.name)
messages = $maildir.list(:cur)
@@ -199,11 +211,16 @@ def do_delete_index
begin
Ag::Storage.delete_index($options.name)
rescue Elasticsearch::Transport::Transport::Errors::NotFound => e
+ $stderr.puts "Index does not exist: #{e}"
rescue => e
$stderr.puts "Cannot delete index: #{e}"
end
end
+def do_create_index
+ Ag::Storage.create($options.name)
+end
+
def do_reindex
# http://babinho.net/2014/07/refresh-your-elasticsearch-index-with-zero-downtime/
abort 'Come back later.'