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

F #5356: fix issue with leading 0 (#2093)

This commit is contained in:
Alejandro Huertas Herrero 2022-05-26 19:40:02 +02:00 committed by GitHub
parent 45885def09
commit f3927bae25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2312,7 +2312,8 @@ EOT
# @return [String] Permissions in octet format
def OpenNebulaHelper.to_octet(perm)
begin
Integer(perm).to_s
Integer(perm)
perm
rescue StandardError
perm = perm.split(',')
ret = 0
@ -2342,7 +2343,15 @@ EOT
STDERR.puts 'Error in permissions format'
exit(-1)
else
ret.to_s
ret = ret.to_s
if ret.size == 1
"00#{ret}"
elsif ret.size == 2
"0#{ret}"
else
ret
end
end
end
end