Permalink
Browse files

moving towards using configliere commands

  • Loading branch information...
Missy Missy
Missy authored and Missy committed May 1, 2013
1 parent 97a19f9 commit 5858ac0f5397e2b9e68fe702864ca314017c2176
Showing with 90 additions and 29 deletions.
  1. +90 −29 squirrel/squirrel.rb
View
@@ -39,35 +39,96 @@
Settings.use :commandline
Settings.use :commands
Settings.description = doc
-Settings.define :output_dir, default: '', description: 'Directory to put output, defaults to current path'
-Settings.define :dump_file, default: nil, description: 'The name of the dumpfile to use, default is nil'
-Settings.define :dump_index, default: nil, description: 'Create dump of the given index, default is nil'
-Settings.define :query, default: nil, description: 'Query to use in order to limit the data extracted from the index, default nil'
-Settings.define :restore_index, default: nil, description: 'Restore the given index from --dump_file, it creates a new index if the given index does not exist, default is nil'
-Settings.define :duplicate_index, default: nil, description: 'Duplicate the given index, defaults to nil'
-Settings.define :duplicate_file, default: nil, description: 'File to pull duplicated files from, defaults to nil'
-Settings.define :restore_index, default: nil, description: 'Restore the given index, defaults to nil'
-Settings.define :restore_file, default: nil, description: 'Dump file to use when restoring, defaults to nil'
-Settings.define :cardinality, :type => Array, default: nil, description: 'Return the cardinality of the given index, defaults to nil'
-Settings.define :card_file, default: nil, description: 'The dump file to grab info from when determining cardinality MUST NOT be compressed, defaults to nil'
-Settings.define :warmers, default: nil, description: 'Use warmers expected values true/false, defaults to nil'
-Settings.define :warmers_index, default: nil, description: 'The index to add the warmer too, remove it from or disable/enable it on, defaults to nil'
-Settings.define :new_warmers_name, default: nil, description: 'Name of warmer to create, defaults to nil'
-Settings.define :create_warmer, default: nil, description: 'Query to create warmer, defaults to nil'
-Settings.define :remove_warmer, default: nil, description: 'Name of warmer to remove, defaults to nil'
-Settings.define :execute_slow_queries, default: nil, description: 'Execute the slow log queries in the provided log file,ie --execute_slow_log=/var/log/elasticsearch/padraig.log, defaults to nil'
-Settings.define :batch_size, default: nil, description: 'Batch size when processing gzip file, defaults to nil'
-Settings.define :dump_mapping, default: nil, description: 'The name of the file in which to dump the indexes mapping, defaults to nil'
-Settings.define :restore_mapping, defualt: nil, description: 'The mapping json file to use when restoring the index, defaults to nil'
-Settings.define :duplicate_mapping, default: nil, description: 'The mapping json file to use when duplicating documents in an index, defaults to nil'
-Settings.define :host, default: nil, description: 'The elasticsearch hostname, defaults to nil'
-Settings.define :port, default: 9200, description: 'The port on the elasticsearch host to connect to, defaults to 9200'
-Settings.define :clear_all_cache, default: nil, description: 'Clear all caches expected true/false, defaults to nil'
-Settings.define :clear_filter_cache, default: nil, description: 'Clear filter cache expected true/false, defaults to nil'
-Settings.define :clear_fielddata, default: nil, description: 'Clear fielddata expected true/false, defaults to nil'
-Settings.define :settings_index, default: nil, description: 'The index that the settings listed in index_settings will be changed for, defaults to nil'
-Settings.define :es_index_settings, :type => Array, default: [], description: 'A comma deliminated list of elasticsearch index settings to be set for --settings_index, defaults to []'
-Settings.define :es_index_settings_values, :type => Array, default: [], description: 'A comma deliminated list of elasticsearch index settings values to be set for --settings_index, defaults to []'
+Settings.define_command :backup, :description => "Create a dump gzip file of an index" do |cmd|
+ cmd.define :output_dir, :type => String, :default => nil, :description => 'Directory to put output, defaults to nil'
+ cmd.define :dump_file, :type => String, :default => nil, :description => 'The name of the dumpfile to use, default is nil'
+ cmd.define :dump_index, :type => String, :default => nil, :description => 'Index to use, default is nil'
+ cmd.define :query, :type => String, :default => nil, :description => 'Query to use in order to limit the data extracted from the index, default nil'
+ cmd.define :host, :type => String, :default => nil, :description => 'The host to connect to, defaults to nil'
+ cmd.define :port, :type => Integer, :default => nil, :description => 'The port to connect to on the host, defaults to nil'
+ cmd.define :dump_mapping, :type => String, :default => nil, :description => 'The file to put the json mapping in, defaults to nil'
+ cmd.define :batch_size, :type => Integer, :default => nil, :description => 'The number of lines to process at once, defaults to nil'
+end
+Settings.define_command :restore, :description => "Take the data from a dump gzip file and use it to populate an index" do |cmd|
+ cmd.define :output_dir, :type => String, :default => nil, :description => 'Directory to put output, defaults to nil'
+ cmd.define :restore_file, :type => String,:default => nil, :description => 'The name of the dumpfile to use, default is nil'
+ cmd.define :restore_index, :type => String,:default => nil, :description => 'Index to use, default is nil'
+ cmd.define :host, :type => String, :default => nil, :description => 'The host to connect to, defaults to nil'
+ cmd.define :port, :type => Integer, :default => nil, :description => 'The port to connect to on the host, defaults to nil'
+ cmd.define :restore_mapping,:type => String,:default => nil, :description => 'The mapping file to use when restoring an index, defaults to nil'
+ cmd.define :batch_size, :type => Integer, :default => nil, :description => 'The number of lines to process at once, defaults to nil'
+end
+Settings.define_command :duplicate, :description => "Take the data from a dump gzip file and add it into an index allowing documents to be duplicated" do |cmd|
+ cmd.define :output_dir, :type => String, :default => nil, :description => 'Directory to put output, defaults to nil'
+ cmd.define :duplicate_file, :type => String, :default => nil, :description => 'The name of the dumpfile to use, default is nil'
+ cmd.define :duplicate_index, :type => String, :default => nil, :description => 'Index to use, default is nil'
+ cmd.define :host, :type => String, :default => nil, :description => 'The host to connect to, defaults to nil'
+ cmd.define :port, :type => Integer, :default => nil, :description => 'The port to connect to on the host, defaults to nil'
+ cmd.define :duplicated_mapping, :type => String, :default => nil, :description => 'The mapping file to use when restoring an index, defaults to nil'
+ cmd.define :batch_size, :type => Integer, :default => nil, :description => 'The number of lines to process at once, defaults to nil'
+end
+Settings.define_command :cardinality, :description => "Count the number of unique valuse for the given field(s)" do |cmd|
+ cmd.define :cardinality, :type => Array, :default => nil, :description => 'Return the cardinality of the given fields, defaults to nil'
+ cmd.define :card_file, :type => String, :default => nil, :description => 'The dump file to grab info from when determining cardinality MUST NOT be compressed, defaults to nil'
+end
+Settings.define_command :warmer, :description => "Interact elasticsearch warmers" do |cmd|
+ cmd.define :warmers, :type => String, :default => nil, :description => 'Use warmers expected values true/false, defaults to nil'
+ cmd.define :warmers_index, :type => String, :default => nil, :description => 'The index to add the warmer too, remove it from or disable/enable it on, defaults to nil'
+ cmd.define :new_warmers_name, :type => String, :default => nil, :description => 'Name of warmer to create, defaults to nil'
+ cmd.define :create_warmer, :type => String, :default => nil, :description => 'Query to create warmer, defaults to nil'
+ cmd.define :remove_warmer, :type => String, :default => nil, :description => 'Name of warmer to remove, defaults to nil'
+ cmd.define :host, :type => String, :default => nil, :description => 'The host to connect to, defaults to nil'
+ cmd.define :port, :type => Integer, :default => nil, :description => 'The port to connect to on the host, defaults to nil'
+end
+Settings.define_command :cache, :description => "Interact with elasticsearch caches" do |cmd|
+ cmd.define :host, :type => String, :default => nil, :description => 'The host to connect to, defaults to nil'
+ cmd.define :port, :type => Integer, :default => nil, :description => 'The port to connect to on the host, defaults to nil'
+ cmd.define :clear_all_cache, :type => String, :default => nil, :description => 'Clear all caches expected true/false, defaults to nil'
+ cmd.define :clear_fielddata, :type => String, :default => nil, :description => 'Clear filter cache expected true/false, defaults to nil'
+ cmd.define :clear_filter_cache, :type => String, :default => nil, :description => 'Clear filter cache expected true/false, defaults to nil'
+end
+Settings.define_command :replay, :description => "Replay slow log queries" do |cmd|
+ cmd.define :host, :type => String, :default => nil, :description => 'The host to connect to, defaults to nil'
+ cmd.define :port, :type => Integer, :default => nil, :description => 'The port to connect to on the host, defaults to nil'
+ cmd.define :execute_slow_queries, :type => String, :default => nil, :description => 'Execute the slow log queries in the provided log file,ie --execute_slow_log=/var/log/elasticsearch/padraig.log, defaults to nil'
+ cmd.define :batch_size, :type => Integer, :default => nil, :description => 'The number of lines to process at once, defaults to nil'
+end
+Settings.define_command :index_settings, :description => "Change the index settings" do |cmd|
+ cmd.define :host, :type => String, :default => nil, :description => 'The host to connect to, defaults to nil'
+ cmd.define :port, :type => Integer, :default => nil, :description => 'The port to connect to on the host, defaults to nil'
+ cmd.define :settings_index, :type => String, :default => nil, :description => 'The index that the settings listed in index_settings will be changed for, defaults to nil'
+ cmd.define :es_index_settings, :type => String, :default => nil, :description => 'A comma deliminated list of elasticsearch index settings to be set for --settings_index, defaults to []'
+ cmd.define :es_index_settings_values, :type => String, :default => nil, :description => 'A comma deliminated list of elasticsearch index settings values to be set for --settings_index, defaults to []'
+end
+#Settings.define :output_dir, default: '', description: 'Directory to put output, defaults to current path'
+#Settings.define :dump_file, default: nil, description: 'The name of the dumpfile to use, default is nil'
+#Settings.define :dump_index, default: nil, description: 'Create dump of the given index, default is nil'
+#Settings.define :query, default: nil, description: 'Query to use in order to limit the data extracted from the index, default nil'
+#Settings.define :restore_index, default: nil, description: 'Restore the given index from --dump_file, it creates a new index if the given index does not exist, default is nil'
+#Settings.define :duplicate_index, default: nil, description: 'Duplicate the given index, defaults to nil'
+#Settings.define :duplicate_file, default: nil, description: 'File to pull duplicated files from, defaults to nil'
+#Settings.define :restore_index, default: nil, description: 'Restore the given index, defaults to nil'
+#Settings.define :restore_file, default: nil, description: 'Dump file to use when restoring, defaults to nil'
+#Settings.define :cardinality, :type => Array, default: nil, description: 'Return the cardinality of the given index, defaults to nil'
+#Settings.define :card_file, default: nil, description: 'The dump file to grab info from when determining cardinality MUST NOT be compressed, defaults to nil'
+#Settings.define :warmers, default: nil, description: 'Use warmers expected values true/false, defaults to nil'
+#Settings.define :warmers_index, default: nil, description: 'The index to add the warmer too, remove it from or disable/enable it on, defaults to nil'
+#Settings.define :new_warmers_name, default: nil, description: 'Name of warmer to create, defaults to nil'
+#Settings.define :create_warmer, default: nil, description: 'Query to create warmer, defaults to nil'
+#Settings.define :remove_warmer, default: nil, description: 'Name of warmer to remove, defaults to nil'
+#Settings.define :execute_slow_queries, default: nil, description: 'Execute the slow log queries in the provided log file,ie --execute_slow_log=/var/log/elasticsearch/padraig.log, defaults to nil'
+#Settings.define :batch_size, default: nil, description: 'Batch size when processing gzip file, defaults to nil'
+#Settings.define :dump_mapping, default: nil, description: 'The name of the file in which to dump the indexes mapping, defaults to nil'
+#Settings.define :restore_mapping, defualt: nil, description: 'The mapping json file to use when restoring the index, defaults to nil'
+#Settings.define :duplicate_mapping, default: nil, description: 'The mapping json file to use when duplicating documents in an index, defaults to nil'
+#Settings.define :host, default: nil, description: 'The elasticsearch hostname, defaults to nil'
+#Settings.define :port, default: 9200, description: 'The port on the elasticsearch host to connect to, defaults to 9200'
+#Settings.define :clear_all_cache, default: nil, description: 'Clear all caches expected true/false, defaults to nil'
+#Settings.define :clear_filter_cache, default: nil, description: 'Clear filter cache expected true/false, defaults to nil'
+#Settings.define :clear_fielddata, default: nil, description: 'Clear fielddata expected true/false, defaults to nil'
+#Settings.define :settings_index, default: nil, description: 'The index that the settings listed in index_settings will be changed for, defaults to nil'
+#Settings.define :es_index_settings, :type => Array, default: [], description: 'A comma deliminated list of elasticsearch index settings to be set for --settings_index, defaults to []'
+#Settings.define :es_index_settings_values, :type => Array, default: [], description: 'A comma deliminated list of elasticsearch index settings values to be set for --settings_index, defaults to []'
Settings.resolve!

0 comments on commit 5858ac0

Please sign in to comment.