Line 108... |
Line 108... |
108 |
'force|f',
|
108 |
'force|f',
|
109 |
'format=s', # must be --format (no short form)
|
109 |
'format=s', # must be --format (no short form)
|
110 |
'help|h',
|
110 |
'help|h',
|
111 |
'quiet|q',
|
111 |
'quiet|q',
|
112 |
'target|t=s',
|
112 |
'target|t=s',
|
- |
|
113 |
'testing',
|
113 |
'verbose|v+',# integer, can be incremented like -vv
|
114 |
'verbose|v+',# integer, can be incremented like -vv
|
114 |
'version|V' # note, the short form is a capital 'V'
|
115 |
'version|V' # note, the short form is a capital 'V'
|
115 |
) or die "Error parsing command line\n";
|
116 |
) or die "Error parsing command line\n";
|
116 |
|
117 |
|
- |
|
118 |
# if they pass the testing flag, turn verbose on, dry run on, and append
|
- |
|
119 |
# .testing to the status db filename
|
- |
|
120 |
if ( $config->{'flags'}->{'testing'} ) {
|
- |
|
121 |
$config->{'flags'}->{'verbose'} = 1;
|
- |
|
122 |
$config->{'flags'}->{'dryrun'} = 1;
|
- |
|
123 |
$config->{'status db filename'} .= '.testing';
|
- |
|
124 |
}
|
- |
|
125 |
|
117 |
print "Parameters are " . Dumper( $config ) . "\n" if $config->{'flags'}->{'debug'};
|
126 |
print "Parameters are " . Dumper( $config ) . "\n" if $config->{'flags'}->{'debug'};
|
118 |
die if $config->{'flags'}->{'debug'} > 3;
|
127 |
die if $config->{'flags'}->{'debug'} > 3;
|
119 |
|
128 |
|
120 |
my $command = shift; # the first one is the actual subsection
|
129 |
my $command = shift; # the first one is the actual subsection
|
121 |
my $action = shift; # second is action to run
|
130 |
my $action = shift; # second is action to run
|
122 |
$action = 'help' unless $action;
|
131 |
$action = 'help' unless $action;
|
123 |
|
132 |
|
124 |
if ( $config->{'flags'}->{'help'} || $command eq 'help' || ! $command ) { &help() ; exit; }
|
133 |
if ( $config->{'flags'}->{'help'} || $command eq 'help' || ! $command ) { &help() ; exit; }
|
125 |
if ( $config->{'flags'}->{'version'} ) { use File::Basename; print basename($0) . " v$VERSION\n"; exit; }
|
134 |
if ( $config->{'flags'}->{'version'} ) { use File::Basename; print basename($0) . " v$VERSION\n"; exit; }
|
126 |
|
135 |
|
- |
|
136 |
|
127 |
print "Command = $command\nAction = $action\n" if $config->{'flags'}->{'debug'};
|
137 |
print "Command = $command\nAction = $action\n" if $config->{'flags'}->{'debug'};
|
128 |
|
138 |
|
129 |
|
139 |
|
130 |
# we allow a three part command for some actions on a domain, ie start, shutdown, migrate and destroy
|
140 |
# we allow a three part command for some actions on a domain, ie start, shutdown, migrate and destroy
|
131 |
# for simplicity, if the command is one of the above, allow the user to enter like that, but we will
|
141 |
# for simplicity, if the command is one of the above, allow the user to enter like that, but we will
|