Fixed iptables.save module to not fail when parent directory already exists.

This commit is contained in:
Jeff Hui 2013-01-23 22:27:05 -08:00
parent c8571a5255
commit e901ae3b14

View File

@ -124,7 +124,9 @@ def save(filename):
salt '*' iptables.save /etc/sysconfig/iptables
'''
os.makedirs(os.path.dirname(filename))
parent_dir = os.path.dirname(filename)
if not os.path.isdir(parent_dir):
os.makedirs(parent_dir)
cmd = 'iptables-save > {0}'.format(filename)
out = __salt__['cmd.run'](cmd)
return out