Skip to content
Snippets Groups Projects
Commit 6248f0b3 authored by Andreas Romeyke's avatar Andreas Romeyke
Browse files

- fixed options

parent 3b811c57
No related branches found
No related tags found
No related merge requests found
......@@ -12,24 +12,29 @@ use namespace::autoclean -except => qr{^SLUB::LZA::TA::.*};
# ABSTRACT: init module for ta-tool
sub abstract { return "Initialize $0";}
sub description { return "Initialize $0, preparing config file."}
sub description { return "Initialize $0, preparing config file using given options"}
sub opt_spec {
return(
["help|h" => "this usage screen"],
#my $common_global_opts= SLUB::LZA::TA::global_opt_spec();
my @local_opts = (
[ "help|h" => "this usage screen" ],
[ "verbose|v" => "enable verbose output" ],
[],
[ "elasticsearch-host|e=s" => "host adress of Archivematica's ElasticSearch (mandatory)" ],
[ "elasticsearch-port|E=s" => "port of Archivematica's ElasticSearch", { default => 9200 } ],
[ "http-only" => "use HTTP instead HTTPS" ],
);
#[ "logdir|l=s" => "logdir where Archivematica stores it server log files", {required => 1}],
# return ($global_opts, $local_opts);
return (@local_opts);
}
sub validate_args {
my ($self, $opt, $args) = @_;
# no args allowed but options!
$self->usage_error("No args allowed") if @$args;
my $app = $self->app;
my $global = $app->global_options;
SLUB::LZA::TA::validate_global($self, $opt, $args);
use Data::Printer;
p($opt);
$self->usage_error("This command requires (global) parameter for elasticsearch host!") if (!exists $opt->{elasticsearch_host});
$self->usage_error("This command requires (global) parameter for logdir!") if (!exists $opt->{logdir});
$self->usage_error("Missed mandatory parameter '--elasticsearch-host'") if (
!exists($opt->{elasticsearch_host})
and exists($opt->{help})
);
return 1;
}
......@@ -38,7 +43,7 @@ sub execute {
my %config;
$config{elasticsearch_host} = $opt->{elasticsearch_host};
$config{elasticsearch_port} = $opt->{elasticsearch_port};
$config{logdir} = $opt->{logdir};
#$config{logdir} = $opt->{logdir};
$config{http_only} = $opt->{http_only};
my $in_test = $ENV{TEST_ACTIVE};
local *IO::Prompt::Tiny::_is_interactive = sub {$in_test}; # fake it for testing
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment