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:
Thomas S Hatch 2013-11-26 08:07:40 -08:00
commit 5637339b2c
4 changed files with 32 additions and 10 deletions

View File

@ -1092,6 +1092,13 @@ class State(object):
found = False
if name not in extend:
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]:
extend[name][_state] = []
extend[name]['__env__'] = body['__env__']
@ -1121,6 +1128,13 @@ class State(object):
continue
_state = next(iter(ind))
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':
# Add prerequired to origin
if id_ not in extend:

View File

@ -37,12 +37,10 @@ C:
D:
cmd.run:
- name: echo D first
# waiting for issue #8773 fix
# issue #8773
# this will generate a warning but will still be done
# as in B, here testing the non-list form (no '-')
- require_in:
cmd: B
# cmd.foo: B
cmd.foo: B
E:
cmd.run:

View File

@ -23,11 +23,10 @@ B:
- name: echo B second
- require_in:
- cmd: A
# waiting for issue #8773 fix
# issue #8773
# this will generate a warning but will still be done
# right syntax is cmd: C
#- cmd.run: C
- cmd: C
- cmd.run: C
C:
cmd.run:
@ -36,12 +35,11 @@ C:
D:
cmd.run:
- name: echo D first
# waiting for issue #8773 fix
# issue #8773 fix
# this will generate a warning but will still be done
# as in B, here testing the non-list form (no '-')
- require_in:
cmd: B
# cmd.foo: B
cmd.foo: B
E:
cmd.run:
@ -63,4 +61,10 @@ G:
- name: echo G
- require:
- cmd: Z
# will fail with "The following requisites were not found"
H:
cmd.run:
- name: echo H
- require:
- cmd.run: Z

View File

@ -511,6 +511,12 @@ fi
'result': False},
'cmd_|-G_|-echo G_|-run': {
'__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'
+ ' require:\n'
+ ' cmd: Z\n',