Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fnmatch traceback #6521

Closed
jcollie opened this issue Aug 5, 2013 · 8 comments · Fixed by #6525
Closed

fnmatch traceback #6521

jcollie opened this issue Aug 5, 2013 · 8 comments · Fixed by #6525
Assignees
Labels
Bug broken, incorrect, or confusing behavior
Milestone

Comments

@jcollie
Copy link
Contributor

jcollie commented Aug 5, 2013

Getting the following traceback on 0.16.0 and 0.16.2. Not really sure where to begin to debug this.

Traceback (most recent call last):
File "/usr/bin/salt-call", line 11, in
salt_call()
File "/usr/lib/python2.7/site-packages/salt/scripts.py", line 76, in salt_call
client.run()
File "/usr/lib/python2.7/site-packages/salt/cli/init.py", line 265, in run
caller.run()
File "/usr/lib/python2.7/site-packages/salt/cli/caller.py", line 129, in run
ret = self.call()
File "/usr/lib/python2.7/site-packages/salt/cli/caller.py", line 70, in call
ret['return'] = func(args, *kwargs)
File "/usr/lib/python2.7/site-packages/salt/modules/state.py", line 283, in sls
ret = st
.state.call_high(high
)
File "/usr/lib/python2.7/site-packages/salt/state.py", line 1508, in call_high
ret = self.call_chunks(chunks)
File "/usr/lib/python2.7/site-packages/salt/state.py", line 1275, in call_chunks
running = self.call_chunk(low, running, chunks)
File "/usr/lib/python2.7/site-packages/salt/state.py", line 1445, in call_chunk
running = self.call_chunk(chunk, running, chunks)
File "/usr/lib/python2.7/site-packages/salt/state.py", line 1385, in call_chunk
status = self.check_requisite(low, running, chunks, True)
File "/usr/lib/python2.7/site-packages/salt/state.py", line 1325, in check_requisite
if (fnmatch.fnmatch(chunk['name'], req_val) or
File "/usr/lib64/python2.7/fnmatch.py", line 43, in fnmatch
return fnmatchcase(name, pat)
File "/usr/lib64/python2.7/fnmatch.py", line 75, in fnmatchcase
res = translate(pat)
File "/usr/lib64/python2.7/fnmatch.py", line 87, in translate
i, n = 0, len(pat)
TypeError: object of type 'NoneType' has no len()

@jcollie
Copy link
Contributor Author

jcollie commented Aug 5, 2013

/etc/systemd/system/rancid@.service:
  file.managed:
    - source: salt://rancid/rancid@.service
    - user: root
    - group: root
    - mode: 0644
    - require:
      - pkg: rancid
      - user: rancid
      - file: /srv/rancid
      - file: /home/rancid/.cloginrc
      - file: 

Found the problem, had an entry that looked like the above, note the incomplete "file" requisite. While it's true that this is a user error, having a proper error message would be useful.

@ghost ghost assigned terminalmage Aug 5, 2013
@thatch45
Copy link
Contributor

thatch45 commented Aug 5, 2013

Yes, this should be an easy thing to catch :)

@terminalmage
Copy link
Contributor

I've already tracked it down.

@thatch45
Copy link
Contributor

thatch45 commented Aug 5, 2013

W00t!

@terminalmage
Copy link
Contributor

I'm about to submit a pull for this. I was able to suppress this traceback by simply skipping the requisite chunks with a value of None. However, in the process I found that the state output looked a bit ugly, so I also changed the state output so that it's a bit more readable. @thatch45 what do you think of the following:

Old:

    State: - pkgrepo
    Name:      deb-src http://packages.dotdeb.org wheezy-php55 all
    Function:  managed
        Result:    False
        Comment:   The following requisites were not found:
                   require: OrderedDict([('file', None)])

        Changes:

New:

    State: - pkgrepo
    Name:      deb-src http://packages.dotdeb.org wheezy-php55 all
    Function:  managed
        Result:    False
        Comment:   The following requisites were not found:
                   require:
                       file: None

        Changes:

@UtahDave
Copy link
Contributor

UtahDave commented Aug 5, 2013

+1 from me. I think that looks much better.

terminalmage added a commit to terminalmage/salt that referenced this issue Aug 5, 2013
This fixes saltstack#6521 by skipping any requisites that have a value of None.
Additionally, the state output for failed requisites has been cleaned up
a bit. See the following link for an example:

saltstack#6521 (comment)
@jcollie
Copy link
Contributor Author

jcollie commented Aug 6, 2013

Thanks everyone for the quick turnaround!

@terminalmage
Copy link
Contributor

No prob! Don't hesitate to let us know if you encounter any other problems.

terminalmage added a commit that referenced this issue Aug 7, 2013
This fixes #6521 by skipping any requisites that have a value of None.
Additionally, the state output for failed requisites has been cleaned up
a bit. See the following link for an example:

#6521 (comment)

Conflicts:
	salt/state.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants