aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/main/perl/vespa-deploy-application
blob: aebf6652f3d0c9099ca7dab7645755c8672c6329 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env perl
# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
# This script is a wrapper exposing the legacy vespa-deploy-application script

use strict;
use warnings;
use Getopt::Long;

my $help=0;
my $debug=0;
my $dryrun=0;
my $force=0;
my $nobackup=0;
my $skip_xml_validation=0;
my $verbose=0;
my $nosudo=0;
my $write=0;
my $outputdir=0;

GetOptions ("h" => \$help,
            "d" => \$debug,
            "n" => \$dryrun,
            "f" => \$force,
            "nobackup" => \$nobackup,
            "skipxmlvalidation" => \$force,
            "v" => \$verbose,
            "nosudo" => \$nosudo,
            "w" => \$write,
            "p" => \$outputdir)
or $help = 1;

if ($help) {
  print_usage();
  exit(0);
}

my $app = shift;

my $flags = " ";
if ($debug) {
  $flags .= "-v "
}
if ($force) {
  $flags .= "-f ";
}
if ($verbose) {
  $flags .= "-v ";
}
if ($dryrun) {
  $flags .= "-n ";
}

print "WARNING: vespa-deploy-application is deprecated, use 'vespa-deploy prepare' instead\n\n";

my $DEPLOY="vespa-deploy $flags prepare $app";

system($DEPLOY);
if ($? == 0) { print "Activate the application by running 'vespa-activate-application'\n"; }

sub print_usage {
  print "\n";
  print "usage: vespa-deploy-application <application-directory>\n";
  print "Switches:\n";
  print "-h This help text\n";
  print "-d Debug (stack trace on exceptions)\n";
  print "-n Dry-run, check application without activating, print the MD5 checksum of the application\n";
#  print "-nobackup Do not backup application package data\n";
#  print "-skipxmlvalidation Skip validation of application package XML files\n";
  print "-v Verbose (progress trace)\n";
#  print "-nosudo Do not sudo as yahoo when deploying\n";
#  print "-w Write .MODEL debugging files when the vespa model is built\n";
  print "-f Force, try to deploy even if package contains errors\n";
#  print "-p <Directory to be used for writing (if using -w) and reading config system files during deploy. Default: $VESPA_HOME/var/db/vespa/config_server/serverdb>\n";
  print "\n";
  print "Verify that the 'yahoo' user has read and execute permissions\n";
  print "to each level of the directory tree from the current directory\n";
  print "down to and including the application directory.\n";
}