diff options
author | Maarten Vanraes <alien@mageia.org> | 2016-05-14 09:19:54 +0200 |
---|---|---|
committer | Maarten Vanraes <alien@mageia.org> | 2016-05-14 09:25:25 +0200 |
commit | aabf25a445394ebd16ebfc075f3b75b5f24c60d3 (patch) | |
tree | aa3b509fea1adb687c1fc848c2f6f9de4ea0e6bb /lib | |
parent | 4c780314dace2294af648228a544fdf50c5b6afb (diff) | |
download | manatools-aabf25a445394ebd16ebfc075f3b75b5f24c60d3.tar manatools-aabf25a445394ebd16ebfc075f3b75b5f24c60d3.tar.gz manatools-aabf25a445394ebd16ebfc075f3b75b5f24c60d3.tar.bz2 manatools-aabf25a445394ebd16ebfc075f3b75b5f24c60d3.tar.xz manatools-aabf25a445394ebd16ebfc075f3b75b5f24c60d3.zip |
Swap: fix action handlers
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ManaTools/Shared/disk_backend/Plugin/Swap.pm | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/ManaTools/Shared/disk_backend/Plugin/Swap.pm b/lib/ManaTools/Shared/disk_backend/Plugin/Swap.pm index 696d7aab..9f1da86f 100644 --- a/lib/ManaTools/Shared/disk_backend/Plugin/Swap.pm +++ b/lib/ManaTools/Shared/disk_backend/Plugin/Swap.pm @@ -107,19 +107,21 @@ override ('probe', sub { $part->prop('active', 1); # add a swapoff action - $part->add_action('swapoff', 'Turn off swap', undef, sub { + $part->add_action('swapoff', 'Turn off swap', $part, sub { my $self = shift; - my $plugin = $self->plugin(); - print STDERR "Dangerous actions are disabled: $self\n"; + my $part = $self->item(); + my $plugin = $part->plugin(); + print STDERR "Dangerous actions are disabled: '". $self->label() ."'\n"; return 1; - if ($plugin->tool_exec('swapoff', $self->prop('filename')) == 0) { - $self->prop('active', 0); + if ($plugin->tool_exec('swapoff', $part->prop('filename')) == 0) { + $part->prop('active', 0); $part->prop('priority', 0); } return 1; }, sub { my $self = shift; - return $self->prop('active') == 1; + my $part = $self->item(); + return $part->prop('active') == 1; }); # use swaplabel to get label and uuid |