diff options
Diffstat (limited to 'python/vyos/util.py')
-rw-r--r-- | python/vyos/util.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/python/vyos/util.py b/python/vyos/util.py index ce5dc51f5..d8e83ab8d 100644 --- a/python/vyos/util.py +++ b/python/vyos/util.py @@ -182,20 +182,16 @@ def call(command, flag='', shell=None, input=None, timeout=None, env=None, return code -def read_file(fname, defaultonfailure=None, strip_end=True): +def read_file(fname, defaultonfailure=None): """ - read the content of a file, optionally stripping any end characters (space, newlines) + read the content of a file, stripping any end characters (space, newlines) should defaultonfailure be not None, it is returned on failure to read """ try: """ Read a file to string """ with open(fname, 'r') as f: - data = f.read() - - if strip_end: - return data.strip() - else: - return data + data = f.read().strip() + return data except Exception as e: if defaultonfailure is not None: return defaultonfailure |