You've already forked pgbackrest
							
							
				mirror of
				https://github.com/pgbackrest/pgbackrest.git
				synced 2025-10-30 23:37:45 +02:00 
			
		
		
		
	Fixed user change in docs missed in vagrant upgrade.
This commit is contained in:
		| @@ -7,6 +7,7 @@ use parent 'BackRestDoc::Common::DocRender'; | ||||
| use strict; | ||||
| use warnings FATAL => qw(all); | ||||
| use Carp qw(confess); | ||||
| use English '-no_match_vars'; | ||||
|  | ||||
| use Exporter qw(import); | ||||
|     our @EXPORT = qw(); | ||||
| @@ -26,6 +27,11 @@ use pgBackRestTest::Common::HostGroupTest; | ||||
|  | ||||
| use BackRestDoc::Common::DocManifest; | ||||
|  | ||||
| #################################################################################################################################### | ||||
| # User that's building the docs | ||||
| #################################################################################################################################### | ||||
| use constant DOC_USER                                              => getpwuid($UID) . ''; | ||||
|  | ||||
| #################################################################################################################################### | ||||
| # CONSTRUCTOR | ||||
| #################################################################################################################################### | ||||
| @@ -103,7 +109,7 @@ sub executeKey | ||||
|     # Add user to command | ||||
|     my $strCommand = $self->{oManifest}->variableReplace(trim($oCommand->fieldGet('exe-cmd'))); | ||||
|     my $strUser = $self->{oManifest}->variableReplace($oCommand->paramGet('user', false, 'postgres')); | ||||
|     $strCommand = ($strUser eq 'vagrant' ? '' : ('sudo ' . ($strUser eq 'root' ? '' : "-u $strUser "))) . $strCommand; | ||||
|     $strCommand = ($strUser eq DOC_USER ? '' : ('sudo ' . ($strUser eq 'root' ? '' : "-u $strUser "))) . $strCommand; | ||||
|  | ||||
|     # Format and split command | ||||
|     $strCommand =~ s/[ ]*\n[ ]*/ \\\n    /smg; | ||||
| @@ -553,7 +559,7 @@ sub backrestConfig | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             my $strLocalFile = "/home/vagrant/data/pgbackrest.conf"; | ||||
|             my $strLocalFile = '/home/' . DOC_USER . '/data/pgbackrest.conf'; | ||||
|  | ||||
|             # Save the ini file | ||||
|             iniSave($strLocalFile, $self->{config}{$strHostName}{$$hCacheKey{file}}, true); | ||||
| @@ -651,7 +657,7 @@ sub postgresConfig | ||||
|                 confess &log(ERROR, "cannot configure postgres on host ${strHostName} because the host does not exist"); | ||||
|             } | ||||
|  | ||||
|             my $strLocalFile = '/home/vagrant/data/postgresql.conf'; | ||||
|             my $strLocalFile = '/home/' . DOC_USER . '/data/postgresql.conf'; | ||||
|             $oHost->copyFrom($$hCacheKey{file}, $strLocalFile); | ||||
|  | ||||
|             if (!defined(${$self->{'pg-config'}}{$strHostName}{$$hCacheKey{file}}{base}) && $self->{bExe}) | ||||
|   | ||||
| @@ -48,7 +48,7 @@ | ||||
|         <variable key="host-os" keyword="default">u14</variable> | ||||
|         <variable key="host-os" keyword="co6">co6</variable> | ||||
|  | ||||
|         <variable key="host-user">vagrant</variable> | ||||
|         <variable key="host-user" eval="y">use English '-no_match_vars'; return getpwuid($UID) . '';</variable> | ||||
|         <variable key="host-mount">/backrest:/backrest</variable> | ||||
|         <variable key="image-repo">pgbackrest/test</variable> | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user