1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

Feature #3021: disallow root to run onehost sync

This commit is contained in:
Jaime Melis 2015-05-26 12:02:43 +02:00
parent 6f1a5c53d7
commit b27d12e48d

View File

@ -167,6 +167,11 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
NUM_THREADS = 15
def sync(host_ids, options)
if `id -u`.to_i == 0 || `id -G`.split.collect{|e| e.to_i}.include?(0)
STDERR.puts("Cannot run 'onehost sync' as root")
exit -1
end
begin
current_version = File.read(REMOTES_LOCATION+'/VERSION').strip
rescue