mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Adding file check and empty list return to freebsd_sysctl.py
This commit is contained in:
parent
469c090330
commit
95a7f125a7
@ -6,6 +6,7 @@ Module for viewing and modifying sysctl parameters
|
||||
# Import Python libs
|
||||
from __future__ import absolute_import, unicode_literals, print_function
|
||||
import logging
|
||||
import os
|
||||
|
||||
# Import salt libs
|
||||
import salt.utils.files
|
||||
@ -66,6 +67,10 @@ def show(config_file=False):
|
||||
comps = ['']
|
||||
|
||||
if config_file:
|
||||
# If the file doesn't exist, return an empty list
|
||||
if not os.path.exists(config_file):
|
||||
return []
|
||||
|
||||
try:
|
||||
with salt.utils.files.fopen(config_file, 'r') as f:
|
||||
for line in f.readlines():
|
||||
|
Loading…
Reference in New Issue
Block a user