mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Merge pull request #8823 from regilero/requisites-fix
Fix #8773: allow syntax error state.foo in requisites with a warning.
This commit is contained in:
commit
5637339b2c
@ -1092,6 +1092,13 @@ class State(object):
|
|||||||
found = False
|
found = False
|
||||||
if name not in extend:
|
if name not in extend:
|
||||||
extend[name] = {}
|
extend[name] = {}
|
||||||
|
if '.' in _state:
|
||||||
|
log.warning(
|
||||||
|
'Bad requisite syntax in {0} : {1} for {2},'
|
||||||
|
+ ' requisites should not contain any dot'
|
||||||
|
.format(rkey,_state,name)
|
||||||
|
)
|
||||||
|
_state = _state.split(".")[0]
|
||||||
if _state not in extend[name]:
|
if _state not in extend[name]:
|
||||||
extend[name][_state] = []
|
extend[name][_state] = []
|
||||||
extend[name]['__env__'] = body['__env__']
|
extend[name]['__env__'] = body['__env__']
|
||||||
@ -1121,6 +1128,13 @@ class State(object):
|
|||||||
continue
|
continue
|
||||||
_state = next(iter(ind))
|
_state = next(iter(ind))
|
||||||
name = ind[_state]
|
name = ind[_state]
|
||||||
|
if '.' in _state:
|
||||||
|
log.warning(
|
||||||
|
'Bad requisite syntax in {0} : {1} for {2},'
|
||||||
|
+ ' requisites should not contain any dot'
|
||||||
|
.format(rkey,_state,name)
|
||||||
|
)
|
||||||
|
_state = _state.split(".")[0]
|
||||||
if key == 'prereq_in':
|
if key == 'prereq_in':
|
||||||
# Add prerequired to origin
|
# Add prerequired to origin
|
||||||
if id_ not in extend:
|
if id_ not in extend:
|
||||||
|
@ -37,12 +37,10 @@ C:
|
|||||||
D:
|
D:
|
||||||
cmd.run:
|
cmd.run:
|
||||||
- name: echo D first
|
- name: echo D first
|
||||||
# waiting for issue #8773 fix
|
# issue #8773
|
||||||
# this will generate a warning but will still be done
|
# this will generate a warning but will still be done
|
||||||
# as in B, here testing the non-list form (no '-')
|
|
||||||
- require_in:
|
- require_in:
|
||||||
cmd: B
|
cmd.foo: B
|
||||||
# cmd.foo: B
|
|
||||||
|
|
||||||
E:
|
E:
|
||||||
cmd.run:
|
cmd.run:
|
||||||
|
@ -23,11 +23,10 @@ B:
|
|||||||
- name: echo B second
|
- name: echo B second
|
||||||
- require_in:
|
- require_in:
|
||||||
- cmd: A
|
- cmd: A
|
||||||
# waiting for issue #8773 fix
|
# issue #8773
|
||||||
# this will generate a warning but will still be done
|
# this will generate a warning but will still be done
|
||||||
# right syntax is cmd: C
|
# right syntax is cmd: C
|
||||||
#- cmd.run: C
|
- cmd.run: C
|
||||||
- cmd: C
|
|
||||||
|
|
||||||
C:
|
C:
|
||||||
cmd.run:
|
cmd.run:
|
||||||
@ -36,12 +35,11 @@ C:
|
|||||||
D:
|
D:
|
||||||
cmd.run:
|
cmd.run:
|
||||||
- name: echo D first
|
- name: echo D first
|
||||||
# waiting for issue #8773 fix
|
# issue #8773 fix
|
||||||
# this will generate a warning but will still be done
|
# this will generate a warning but will still be done
|
||||||
# as in B, here testing the non-list form (no '-')
|
# as in B, here testing the non-list form (no '-')
|
||||||
- require_in:
|
- require_in:
|
||||||
cmd: B
|
cmd.foo: B
|
||||||
# cmd.foo: B
|
|
||||||
|
|
||||||
E:
|
E:
|
||||||
cmd.run:
|
cmd.run:
|
||||||
@ -63,4 +61,10 @@ G:
|
|||||||
- name: echo G
|
- name: echo G
|
||||||
- require:
|
- require:
|
||||||
- cmd: Z
|
- cmd: Z
|
||||||
|
# will fail with "The following requisites were not found"
|
||||||
|
H:
|
||||||
|
cmd.run:
|
||||||
|
- name: echo H
|
||||||
|
- require:
|
||||||
|
- cmd.run: Z
|
||||||
|
|
||||||
|
@ -511,6 +511,12 @@ fi
|
|||||||
'result': False},
|
'result': False},
|
||||||
'cmd_|-G_|-echo G_|-run': {
|
'cmd_|-G_|-echo G_|-run': {
|
||||||
'__run_num__': 6,
|
'__run_num__': 6,
|
||||||
|
'comment': 'The following requisites were not found:\n'
|
||||||
|
+ ' require:\n'
|
||||||
|
+ ' cmd: Z\n',
|
||||||
|
'result': False},
|
||||||
|
'cmd_|-H_|-echo H_|-run': {
|
||||||
|
'__run_num__': 7,
|
||||||
'comment': 'The following requisites were not found:\n'
|
'comment': 'The following requisites were not found:\n'
|
||||||
+ ' require:\n'
|
+ ' require:\n'
|
||||||
+ ' cmd: Z\n',
|
+ ' cmd: Z\n',
|
||||||
|
Loading…
Reference in New Issue
Block a user