Skip to content

Commit

Permalink
Use get_var to replace hardcode password
Browse files Browse the repository at this point in the history
  • Loading branch information
XGWang0 authored and alice-suse committed Feb 10, 2022
1 parent c3751a0 commit 61a1f75
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/proxymode.pm
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ our $SLAVE_SERIALDEV = 'proxyserial';

sub switch_power {
my ($ipmi_machine, $ipmi_user, $ipmi_pass, $ipmi_status) = @_;
$ipmi_pass //= 'ADMIN';
$ipmi_user //= 'ADMIN';
$ipmi_pass //= get_var('IPMI_PASSWORD');
$ipmi_user //= get_var('IPMI_USER');
$ipmi_status //= 'off';
die "Variable ipmi_machine is invalid in function restart_host!" unless $ipmi_machine;
my $ipmitool = "ipmitool -H " . $ipmi_machine . " -U " . $ipmi_user . " -P " . $ipmi_pass . " -I lanplus ";
Expand All @@ -43,8 +43,8 @@ sub restart_host {

sub connect_slave {
my ($self, $ipmi_machine, $ipmi_user, $ipmi_pass) = @_;
$ipmi_user //= 'ADMIN';
$ipmi_pass //= 'ADMIN';
$ipmi_user //= get_var('IPMI_PASSWORD');
$ipmi_pass //= get_var('IPMI_USER');
die "Variable ipmi_machine is invalid in function connect_slave!" unless $ipmi_machine;
script_run("clear");
type_string("ipmitool -H " . $ipmi_machine . " -U " . $ipmi_user . " -P " . $ipmi_pass . " -I lanplus sol activate", 20);
Expand Down

0 comments on commit 61a1f75

Please sign in to comment.