mirror of
https://github.com/valitydev/salt.git
synced 2024-11-09 01:36:48 +00:00
Don't apply network states when test=true (#1817)
This commit is contained in:
parent
4c81dc6c7a
commit
705754aca4
@ -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)
|
||||
|
@ -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']:
|
||||
|
Loading…
Reference in New Issue
Block a user