]> git.proxmox.com Git - pve-access-control.git/blobdiff - PVE/RPCEnvironment.pm
fix perl syntax
[pve-access-control.git] / PVE / RPCEnvironment.pm
index a0c0c3328f2313ce0f73d1e453808ea6b4f968ee..f65a776134b271a8d6b0c8e3fd5c1e8280997280 100644 (file)
@@ -180,7 +180,7 @@ sub init {
 
     die "already initialized" if $pve_env;
 
-    die "unknown environment type" if !$type || $type !~ m/^(cli|pub|priv)$/;
+    die "unknown environment type" if !$type || $type !~ m/^(cli|pub|priv|ha)$/;
 
     $SIG{CHLD} = $worker_reaper;
 
@@ -188,6 +188,7 @@ sub init {
     # cli  ... command started fron command line
     # pub  ... access from public server (apache)
     # priv ... access from private server (pvedaemon)
+    # ha   ... access from HA resource manager agent (rgmanager)
     
     my $self = {
        user_cfg => {},
@@ -276,6 +277,8 @@ sub init_request {
 
     PVE::Cluster::cfs_update();
 
+    $self->{result_attributes} = {};
+
     my $userconfig; # we use this for regression tests
     foreach my $p (keys %params) {
        if ($p eq 'userconfig') {
@@ -324,16 +327,16 @@ sub get_client_ip {
     return $self->{client_ip};
 }
 
-sub set_result_count {
-    my ($self, $count) = @_;
+sub set_result_attrib {
+    my ($self, $key, $value) = @_;
 
-    $self->{result_count} = $count;
+    $self->{result_attributes}->{$key} = $value;
 }
 
-sub get_result_count {
-    my ($self) = @_;
+sub get_result_attrib {
+    my ($self, $key) = @_;
 
-    return $self->{result_count};
+    return $self->{result_attributes}->{$key};
 }
 
 sub set_language {
@@ -637,6 +640,9 @@ sub fork_worker {
        POSIX::read($csync[0], $readbuf, 4096);
        die "parent setup error\n" if $readbuf ne 'OK';
 
+       if ($self->{type} eq 'ha') {
+           print "task started by HA resource agent\n";
+       }
        eval { &$function($upid); };
        my $err = $@;
        if ($err) {