mirror of
https://github.com/ovh/the-bastion.git
synced 2025-09-19 11:24:25 +08:00
40 lines
1.1 KiB
Perl
Executable file
40 lines
1.1 KiB
Perl
Executable file
#! /usr/bin/env perl
|
|
# vim: set filetype=perl ts=4 sw=4 sts=4 et:
|
|
use common::sense;
|
|
|
|
use File::Basename;
|
|
use lib dirname(__FILE__) . '/../../../lib/perl';
|
|
use OVH::Result;
|
|
use OVH::Bastion;
|
|
use OVH::Bastion::Plugin qw( :DEFAULT help );
|
|
|
|
OVH::Bastion::Plugin::begin(
|
|
argv => \@ARGV,
|
|
header => "unfreeze a previously frozen account",
|
|
options => {"account=s" => \my $account},
|
|
helptext => <<'EOF',
|
|
Unfreeze a frozen account
|
|
|
|
Usage: --osh SCRIPT_NAME --account ACCOUNT
|
|
|
|
--account ACCOUNT Account to unfreeze
|
|
EOF
|
|
);
|
|
|
|
my $fnret;
|
|
|
|
if (not $account) {
|
|
help();
|
|
osh_exit 'ERR_MISSING_PARAMETER', "Missing 'account' parameter";
|
|
}
|
|
|
|
# Here we parse account name
|
|
$fnret = OVH::Bastion::is_bastion_account_valid_and_existing(account => $account);
|
|
$fnret or osh_exit $fnret;
|
|
$account = $fnret->value->{'account'};
|
|
|
|
my @command = qw{ sudo -n -u allowkeeper -- /usr/bin/env perl -T };
|
|
push @command, $OVH::Bastion::BASEPATH . '/bin/helper/osh-accountFreezeToggle', '--action', 'unfreeze';
|
|
push @command, ('--account', $account);
|
|
|
|
osh_exit(OVH::Bastion::helper(cmd => \@command));
|