diff options
author | Andy Dirnberger <andy@dirnberger.me> | 2016-11-12 18:01:05 -0500 |
---|---|---|
committer | Toshio Kuratomi <a.badger@gmail.com> | 2016-11-17 15:33:43 -0800 |
commit | 2db444a5dd205a819ced8763a882d0001331de2e (patch) | |
tree | ad2283c865c210a605d74b6cc72cb10d08793b26 | |
parent | f424bca7b9254272469d9a9301c20dce2cfc075a (diff) | |
download | ansible-modules-extras-2db444a5dd205a819ced8763a882d0001331de2e.tar.gz |
Make Homebrew-related modules run on Python 3
Both the `homebrew` and `homebrew_cask` modules iterate over
dictionaries using `iteritems`. This is a Python 2-specific method whose
behavior is similar to `items` in Python 3+. The `iteritems` function in
the six library was designed to make it possible to use the correct
method.
(cherry picked from commit d3c804c758d3f6ac07bfdde99be1097eca93ee50)
-rwxr-xr-x | packaging/os/homebrew.py | 4 | ||||
-rwxr-xr-x | packaging/os/homebrew_cask.py | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/packaging/os/homebrew.py b/packaging/os/homebrew.py index fa61984e..482e1b92 100755 --- a/packaging/os/homebrew.py +++ b/packaging/os/homebrew.py @@ -101,6 +101,8 @@ EXAMPLES = ''' import os.path import re +from ansible.module_utils.six import iteritems + # exceptions -------------------------------------------------------------- {{{ class HomebrewException(Exception): @@ -348,7 +350,7 @@ class Homebrew(object): self.message = '' def _setup_instance_vars(self, **kwargs): - for key, val in kwargs.iteritems(): + for key, val in iteritems(kwargs): setattr(self, key, val) def _prep(self): diff --git a/packaging/os/homebrew_cask.py b/packaging/os/homebrew_cask.py index debcb788..2d172239 100755 --- a/packaging/os/homebrew_cask.py +++ b/packaging/os/homebrew_cask.py @@ -75,6 +75,8 @@ EXAMPLES = ''' import os.path import re +from ansible.module_utils.six import iteritems + # exceptions -------------------------------------------------------------- {{{ class HomebrewCaskException(Exception): @@ -309,7 +311,7 @@ class HomebrewCask(object): self.message = '' def _setup_instance_vars(self, **kwargs): - for key, val in kwargs.iteritems(): + for key, val in iteritems(kwargs): setattr(self, key, val) def _prep(self): |