DR: detect if a command is run without sudo privileges
Description
While testing DR, I ran the following command gitlab-ctl replicate-geo-database --host=primary
and got this error message
---------------------------------------------------------------
WARNING: Make sure this script is run from the secondary server
---------------------------------------------------------------
This script will disable you local PostgreSQL database and start
a backup/restore from the primary node at 'primary'
*** You have 60 seconds to hit CTRL-C ***
* Stopping PostgreSQL and all GitLab services
[ERROR] Failed to execute: gitlab-ctl stop
It took me a while to figure out what I did wrong when in fact, I ran the command without being sudo
.
Proposal
If during the setup of DR, we run a command without sudo
, we should detect it and raise a proper warning.