Skip to content

Instantly share code, notes, and snippets.

@quantonganh
Last active January 1, 2016 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quantonganh/8160034 to your computer and use it in GitHub Desktop.
Save quantonganh/8160034 to your computer and use it in GitHub Desktop.
brew module - AttributeError: 'module' object has no attribute 'compare_dicts'

salt --versions-report:

           Salt: 0.17.2
         Python: 2.7.6 (default, Nov 19 2013, 02:02:54)
         Jinja2: 2.7.1
       M2Crypto: 0.21.1
 msgpack-python: 0.4.0
   msgpack-pure: Not Installed
       pycrypto: 2.6.1
         PyYAML: 3.10
          PyZMQ: 14.0.0
            ZMQ: 3.2.4

rabbitmq/init.sls:

rabbitmq:
  pkg:
    - installed
    - require:
      - cmd: brew-update
  module:
    - run
    - name: service.start
    - job_label: homebrew.mxcl.rabbitmq

salt '*' state.sls rabbitmq:

    Name:      rabbitmq
    Function:  installed
        Result:    False
        Comment:   An exception occurred in this state: Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/salt/state.py", line 1278, in call
    *cdata['args'], **cdata['kwargs'])
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/salt/states/pkg.py", line 465, in installed
    **kwargs)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/salt/modules/brew.py", line 280, in install
    return salt.utils.compare_dicts(old, new)
AttributeError: 'module' object has no attribute 'compare_dicts'
@quantonganh
Copy link
Author

As a workaround, I have overrided this module and changed that line from:

return salt.utils.compare_dicts(old, new)

to:

return __salt__['pkg_resource.find_changes'](old, new)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment