]> git.proxmox.com Git - pve-access-control.git/blobdiff - PVE/RPCEnvironment.pm
add a way to return file changes (diffs)
[pve-access-control.git] / PVE / RPCEnvironment.pm
index a0c0c3328f2313ce0f73d1e453808ea6b4f968ee..45cc84d665c765e46b30fdc71f1ffb9472812166 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,9 @@ sub init_request {
 
     PVE::Cluster::cfs_update();
 
+    $self->{result_count} = undef;
+    $self->{result_changes} = undef;
+
     my $userconfig; # we use this for regression tests
     foreach my $p (keys %params) {
        if ($p eq 'userconfig') {
@@ -336,6 +340,18 @@ sub get_result_count {
     return $self->{result_count};
 }
 
+sub set_result_changes {
+    my ($self, $diff) = @_;
+
+    $self->{result_changes} = $diff;
+}
+
+sub get_result_changes {
+    my ($self) = @_;
+
+    return $self->{result_changes};
+}
+
 sub set_language {
     my ($self, $lang) = @_;
 
@@ -637,6 +653,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) {