# along with this library; if not, see <http://www.gnu.org/licenses>.
#
-import grp
-import os
from run import Run
+import os
+
# function to indent a block of text by cnt number of spaces
def indent(in_str, cnt):
leading_indent = cnt * ' '
return ''.join(leading_indent + line for line in in_str.splitlines(True))
+
def get_file_owner_uid(config, filename):
cmd = list()
cmd.append('stat')
cmd.append('-c')
- cmd.append('\'%u\'')
+ cmd.append("'%u'")
cmd.append(filename)
if config.args.container:
else:
return Run.run(cmd, shell_bool=True)
+
def get_file_owner_username(config, filename):
cmd = list()
cmd.append('stat')
cmd.append('-c')
- cmd.append('\'%U\'')
+ cmd.append("'%U'")
cmd.append(filename)
if config.args.container:
return Run.run(cmd, shell_bool=True)
return os.stat(filename).st_uid
+
def get_file_owner_gid(config, filename):
cmd = list()
cmd.append('stat')
cmd.append('-c')
- cmd.append('\'%g\'')
+ cmd.append("'%g'")
cmd.append(filename)
if config.args.container:
else:
return Run.run(cmd, shell_bool=True)
+
def get_file_owner_group_name(config, filename):
cmd = list()
cmd.append('stat')
cmd.append('-c')
- cmd.append('\'%G\'')
+ cmd.append("'%G'")
cmd.append(filename)
if config.args.container:
else:
return Run.run(cmd, shell_bool=True)
+
def get_file_permissions(config, filename):
cmd = list()
cmd.append('stat')
cmd.append('-c')
- cmd.append('\'%a\'')
+ cmd.append("'%a'")
cmd.append(filename)
if config.args.container: