Page MenuHomeVyOS Platform

unify the chmod_ function of VyOS
Closed, WontfixPublicFEATURE REQUEST

Description

VyOS currently has:

def chmod_600(path):
def chmod_750(path):
def chmod_755(path):

which are setting permissions using stats but it would be simpler to express it in Octal and just have one function:

Taking chmod_750 as example:

> from stat import S_IRUSR, S_IWUSR, S_IXUSR, S_IRGRP, S_IXGRP
> bitmask = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP
> oct(bitmask)
'0o750'

so chmod_750(path) could be rewritten using chmod(path, 0o750) with def chmod checking for the folder existance and calling os.chmod with the bitmask passed.

Details

Difficulty level
Unknown (require assessment)
Version
-
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Internal change (not visible to end users)