|
|
@ -158,19 +158,19 @@ sub remove_constraint |
|
|
|
my $rule_found = 0; |
|
|
|
my $rule_found = 0; |
|
|
|
my $rule_output = ""; |
|
|
|
my $rule_output = ""; |
|
|
|
my $shell_call = $conf->{path}{exe}{crm_attribute}." --type nodes --node ".$target_node." --name ".$rule_name." --query"; |
|
|
|
my $shell_call = $conf->{path}{exe}{crm_attribute}." --type nodes --node ".$target_node." --name ".$rule_name." --query"; |
|
|
|
to_log($conf, {message => "Calling: [".$shell_call."]", 'line' => __LINE__, level => 2}); |
|
|
|
to_log($conf, {message => "Calling: [".$shell_call."]", 'line' => __LINE__, level => 1}); |
|
|
|
open (my $file_handle, $shell_call." 2>&1 |") or die "Failed to call: [".$shell_call."]. The error was: $!\n"; |
|
|
|
open (my $file_handle, $shell_call." 2>&1 |") or die "Failed to call: [".$shell_call."]. The error was: $!\n"; |
|
|
|
while(<$file_handle>) |
|
|
|
while(<$file_handle>) |
|
|
|
{ |
|
|
|
{ |
|
|
|
# This should not generate output. |
|
|
|
# This should not generate output. |
|
|
|
chomp; |
|
|
|
chomp; |
|
|
|
my $line = $_; |
|
|
|
my $line = $_; |
|
|
|
to_log($conf, {message => "Output: [".$line."]", 'line' => __LINE__, level => 2}); |
|
|
|
to_log($conf, {message => "Output: [".$line."]", 'line' => __LINE__, level => 1}); |
|
|
|
|
|
|
|
|
|
|
|
if (($line =~ /name=$rule_name/) && ($line =~ /value=0/)) |
|
|
|
if (($line =~ /name=$rule_name/) && ($line =~ /value=0/)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$rule_set = 0; |
|
|
|
$rule_set = 0; |
|
|
|
to_log($conf, {message => "rule_set: [".$rule_set."]", 'line' => __LINE__, level => 2}); |
|
|
|
to_log($conf, {message => "rule_set: [".$rule_set."]", 'line' => __LINE__, level => 1}); |
|
|
|
last; |
|
|
|
last; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
@ -189,33 +189,33 @@ sub remove_constraint |
|
|
|
|
|
|
|
|
|
|
|
# Clear the node attribute |
|
|
|
# Clear the node attribute |
|
|
|
$shell_call = $conf->{path}{exe}{crm_attribute}." --type nodes --node ".$target_node." --name ".$rule_name." --update 0"; |
|
|
|
$shell_call = $conf->{path}{exe}{crm_attribute}." --type nodes --node ".$target_node." --name ".$rule_name." --update 0"; |
|
|
|
to_log($conf, {message => "Calling: [".$shell_call."]", 'line' => __LINE__, level => 2}); |
|
|
|
to_log($conf, {message => "Calling: [".$shell_call."]", 'line' => __LINE__, level => 1}); |
|
|
|
open ($file_handle, $shell_call." 2>&1 |") or die "Failed to call: [".$shell_call."]. The error was: $!\n"; |
|
|
|
open ($file_handle, $shell_call." 2>&1 |") or die "Failed to call: [".$shell_call."]. The error was: $!\n"; |
|
|
|
while(<$file_handle>) |
|
|
|
while(<$file_handle>) |
|
|
|
{ |
|
|
|
{ |
|
|
|
# This should not generate output. |
|
|
|
# This should not generate output. |
|
|
|
chomp; |
|
|
|
chomp; |
|
|
|
my $line = $_; |
|
|
|
my $line = $_; |
|
|
|
to_log($conf, {message => "Output: [".$line."]", 'line' => __LINE__, level => 3}); |
|
|
|
to_log($conf, {message => "Output: [".$line."]", 'line' => __LINE__, level => 1}); |
|
|
|
} |
|
|
|
} |
|
|
|
close $file_handle; |
|
|
|
close $file_handle; |
|
|
|
|
|
|
|
|
|
|
|
# Check that the rule was set. |
|
|
|
# Check that the rule was set. |
|
|
|
$rule_output = ""; |
|
|
|
$rule_output = ""; |
|
|
|
$shell_call = $conf->{path}{exe}{crm_attribute}." --type nodes --node ".$target_node." --name ".$rule_name." --query"; |
|
|
|
$shell_call = $conf->{path}{exe}{crm_attribute}." --type nodes --node ".$target_node." --name ".$rule_name." --query"; |
|
|
|
to_log($conf, {message => "Calling: [".$shell_call."]", 'line' => __LINE__, level => 2}); |
|
|
|
to_log($conf, {message => "Calling: [".$shell_call."]", 'line' => __LINE__, level => 1}); |
|
|
|
open ($file_handle, $shell_call." 2>&1 |") or die "Failed to call: [".$shell_call."]. The error was: $!\n"; |
|
|
|
open ($file_handle, $shell_call." 2>&1 |") or die "Failed to call: [".$shell_call."]. The error was: $!\n"; |
|
|
|
while(<$file_handle>) |
|
|
|
while(<$file_handle>) |
|
|
|
{ |
|
|
|
{ |
|
|
|
# This should not generate output. |
|
|
|
# This should not generate output. |
|
|
|
chomp; |
|
|
|
chomp; |
|
|
|
my $line = $_; |
|
|
|
my $line = $_; |
|
|
|
to_log($conf, {message => "Output: [".$line."]", 'line' => __LINE__, level => 2}); |
|
|
|
to_log($conf, {message => "Output: [".$line."]", 'line' => __LINE__, level => 1}); |
|
|
|
|
|
|
|
|
|
|
|
if (($line =~ /name=$rule_name/) && ($line =~ /value=0/)) |
|
|
|
if (($line =~ /name=$rule_name/) && ($line =~ /value=0/)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$rule_set = 0; |
|
|
|
$rule_set = 0; |
|
|
|
to_log($conf, {message => "rule_set: [".$rule_set."]", 'line' => __LINE__, level => 2}); |
|
|
|
to_log($conf, {message => "rule_set: [".$rule_set."]", 'line' => __LINE__, level => 1}); |
|
|
|
last; |
|
|
|
last; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|