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

modules/ebuild: Add handling for InvalidAtom exception #34727

Conversation

eliasp
Copy link
Contributor

@eliasp eliasp commented Jul 17, 2016

Otherwise, an invalid pkg atom such as generated by the following state:

sys-apps/systemd:
  pkg.installed:
    - pkgs:
      - sys-apps/systemd: '[curl, importd, nat]'

…would lead to this backtrace:

          ID: sys-apps/systemd
    Function: pkg.installed
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/lib64/python2.7/site-packages/salt/state.py", line 1723, in call
                  **cdata['kwargs'])
                File "/usr/lib64/python2.7/site-packages/salt/loader.py", line 1650, in wrapper
                  return f(*args, **kwargs)
                File "/usr/lib64/python2.7/site-packages/salt/states/pkg.py", line 1062, in installed
                  **kwargs)
                File "/usr/lib64/python2.7/site-packages/salt/states/pkg.py", line 454, in _find_install_targets
                  if not __salt__['pkg_resource.check_extra_requirements'](key, val):
                File "/usr/lib64/python2.7/site-packages/salt/modules/pkg_resource.py", line 290, in check_extra_requirements
                  return __salt__['pkg.check_extra_requirements'](pkgname, pkgver)
                File "/usr/lib64/python2.7/site-packages/salt/modules/ebuild.py", line 1059, in check_extra_requirements
                  cpv = _porttree().dbapi.xmatch('bestmatch-visible', atom)
                File "/usr/lib64/python2.7/site-packages/portage/dbapi/porttree.py", line 835, in xmatch
                  mydep = dep_expand(origdep, mydb=self, settings=self.settings)
                File "/usr/lib64/python2.7/site-packages/portage/proxy/objectproxy.py", line 31, in __call__
                  return result(*args, **kwargs)
                File "/usr/lib64/python2.7/site-packages/portage/dbapi/dep_expand.py", line 35, in dep_expand
                  mydep = Atom(mydep, allow_repo=True)
                File "/usr/lib64/python2.7/site-packages/portage/dep/__init__.py", line 1366, in __init__
                  use = _use_dep(use_str[1:-1].split(","), eapi_attrs)
                File "/usr/lib64/python2.7/site-packages/portage/dep/__init__.py", line 855, in __init__
                  raise InvalidAtom(_("Invalid use dep: '%s'") % (x,))
              InvalidAtom: Invalid use dep: ' importd'
     Started: 21:53:35.925124
    Duration: 999.249 ms
     Changes:

Otherwise, an invalid pkg atom such as generated by the following state:

```SaltStack
sys-apps/systemd:
  pkg.installed:
    - pkgs:
      - sys-apps/systemd: '[curl, importd, nat]'
```

…would lead to this backtrace:

```
          ID: sys-apps/systemd
    Function: pkg.installed
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/lib64/python2.7/site-packages/salt/state.py", line 1723, in call
                  **cdata['kwargs'])
                File "/usr/lib64/python2.7/site-packages/salt/loader.py", line 1650, in wrapper
                  return f(*args, **kwargs)
                File "/usr/lib64/python2.7/site-packages/salt/states/pkg.py", line 1062, in installed
                  **kwargs)
                File "/usr/lib64/python2.7/site-packages/salt/states/pkg.py", line 454, in _find_install_targets
                  if not __salt__['pkg_resource.check_extra_requirements'](key, val):
                File "/usr/lib64/python2.7/site-packages/salt/modules/pkg_resource.py", line 290, in check_extra_requirements
                  return __salt__['pkg.check_extra_requirements'](pkgname, pkgver)
                File "/usr/lib64/python2.7/site-packages/salt/modules/ebuild.py", line 1059, in check_extra_requirements
                  cpv = _porttree().dbapi.xmatch('bestmatch-visible', atom)
                File "/usr/lib64/python2.7/site-packages/portage/dbapi/porttree.py", line 835, in xmatch
                  mydep = dep_expand(origdep, mydb=self, settings=self.settings)
                File "/usr/lib64/python2.7/site-packages/portage/proxy/objectproxy.py", line 31, in __call__
                  return result(*args, **kwargs)
                File "/usr/lib64/python2.7/site-packages/portage/dbapi/dep_expand.py", line 35, in dep_expand
                  mydep = Atom(mydep, allow_repo=True)
                File "/usr/lib64/python2.7/site-packages/portage/dep/__init__.py", line 1366, in __init__
                  use = _use_dep(use_str[1:-1].split(","), eapi_attrs)
                File "/usr/lib64/python2.7/site-packages/portage/dep/__init__.py", line 855, in __init__
                  raise InvalidAtom(_("Invalid use dep: '%s'") % (x,))
              InvalidAtom: Invalid use dep: ' importd'
     Started: 21:53:35.925124
    Duration: 999.249 ms
     Changes:
```
@rallytime
Copy link
Contributor

Thanks @eliasp!

@rallytime rallytime merged commit 76cf064 into saltstack:develop Jul 17, 2016
gitebra pushed a commit to gitebra/salt that referenced this pull request Jul 18, 2016
* upstream/develop: (97 commits)
  Document how to test for the existence of a log message (saltstack#34738)
  Use six.iteritems instead of iteritems() in configcomparer
  Use six.iteritems instead of iteritems() in etcd_util
  Use six.iteritems instead of iteritems() in psutil_compat
  Use six.iteritems instead of iteritems() in junos grains
  Use six.iteritems instead of iteritems() in vultrpy driver
  Use six.iteritems instead of iteritems() in profitbricks driver
  Use six.iteritems instead of iteritems() in nova driver
  Use six.iteritems instead of iteritems() in linode driver
  Use six.iteritems instead of iteritems() in ec2 driver
  modules/ebuild: Add handling for InvalidAtom exception (saltstack#34727)
  Add valid function to mine module.
  Loop over updated keys in non recursive update
  Update mock value to match change in saltstack#34270.
  Add versionadded to "special" option in cron.present state (saltstack#34707)
  NILinuxRT fix timezone module (saltstack#34710)
  Add state module to manage InfluxDB databases
  Add state module to manage InfluxDB users
  Add influx module for InfluxDB 0.9+
  Normalise function argument formatting
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants