| 1 | package Helm::Task::unlock; | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | use Moose; | ||
| 5 | |||
| 6 | extends 'Helm::Task'; | ||
| 7 | |||
| 8 | # nothing to do here | ||
| 9 | sub validate { } | ||
| 10 | |||
| 11 | sub help { | ||
| 12 | my ($self, $task) = @_; | ||
| 13 | my $text = <<END; | ||
| 14 | Clears out a Helm lock on a remote server. This is helpful if something | ||
| 15 | goes awry and a lock is stuck preventing you from running helm against | ||
| 16 | that remote server. Note: it probably doesn't make any sense to run this | ||
| 17 | task with the "--lock both" or "--lock remote" options. | ||
| 18 | |||
| 19 | CAUTION: Make sure that the lock is really an artefact of a previous | ||
| 20 | run and not something currently being run by someone else or bad things | ||
| 21 | could happen. | ||
| 22 | |||
| 23 | helm unlock | ||
| 24 | END | ||
| 25 | } | ||
| 26 | |||
| 27 | |||
| 28 | sub execute { | ||
| 29 | my ($self, %args) = @_; | ||
| 30 | my $server = $args{server}; | ||
| 31 | my $ssh = $args{ssh}; | ||
| 32 | my $helm = $self->helm; | ||
| 33 | |||
| 34 | $helm->log->info("Clearing remote lock on $server"); | ||
| 35 | # kind of icky to be using the private message like this | ||
| 36 | $helm->_release_remote_lock($ssh); | ||
| 37 | } | ||
| 38 | |||
| 39 | __PACKAGE__->meta->make_immutable; | ||
| 40 | |||
| 41 | 1; |