Don't apply network states when test=true (#1817)

This commit is contained in:
Bret Palsson 2012-08-13 17:10:01 -06:00
parent 4c81dc6c7a
commit 705754aca4
2 changed files with 8 additions and 0 deletions

View File

@ -749,6 +749,9 @@ def build_interface(iface, iface_type, enabled, settings):
template = env.get_template('rh{0}_eth.jinja'.format(rh_major))
ifcfg = template.render(opts)
if settings['test']:
return ifcfg
_write_file_iface(iface, ifcfg, _RH_NETWORK_SCRIPT_DIR, 'ifcfg-{0}')
path = join(_RH_NETWORK_SCRIPT_DIR, 'ifcfg-{0}'.format(iface))
return _read_file(path)
@ -849,6 +852,9 @@ def build_network_settings(settings):
opts = _parse_network_settings(settings,current_network_settings)
template = env.get_template('network.jinja')
network = template.render(opts)
if settings['test']:
return network
# Wirte settings
_write_file_network(network, _RH_NETWORK_FILE)

View File

@ -167,6 +167,7 @@ def managed(name, type, enabled=True, **kwargs):
# Build interface
try:
kwargs['test'] = __opts__['test']
old = __salt__['ip.get_interface'](name)
new = __salt__['ip.build_interface'](name, type, enabled, kwargs)
if __opts__['test']:
@ -244,6 +245,7 @@ def system(name, **kwargs):
apply_net_settings = False
# Build global network settings
try:
kwargs['test'] = __opts__['test']
old = __salt__['ip.get_network_settings']()
new = __salt__['ip.build_network_settings'](kwargs)
if __opts__['test']: