Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. diff --git a/filter_plugins/oo_filters.py b/filter_plugins/oo_filters.py
  2. index 10c8600..e724ee2 100644
  3. --- a/filter_plugins/oo_filters.py
  4. +++ b/filter_plugins/oo_filters.py
  5. @@ -11,6 +11,7 @@ import pdb
  6. import random
  7. import re
  8.  
  9. +from base64 import b64encode
  10. from collections import Mapping
  11. # pylint no-name-in-module and import-error disabled here because pylint
  12. # fails to properly detect the packages when installed in a virtualenv
  13. @@ -673,7 +674,7 @@ def oo_generate_secret(num_bytes):
  14. raise errors.AnsibleFilterError("|failed expects num_bytes is int")
  15.  
  16. secret = os.urandom(num_bytes)
  17. - return secret.encode('base-64').strip()
  18. + return b64encode(os.urandom(num_bytes)).decode('utf-8')
  19.  
  20.  
  21. def to_padded_yaml(data, level=0, indent=2, **kw):
  22. diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py
  23. index adeb85c..1498706 100755
  24. --- a/roles/openshift_facts/library/openshift_facts.py
  25. +++ b/roles/openshift_facts/library/openshift_facts.py
  26. @@ -1916,8 +1916,8 @@ class OpenShiftFacts(object):
  27. self.system_facts = ansible_facts(module, ['hardware', 'network', 'virtual', 'facter']) # noqa: F405
  28. for (k, v) in self.system_facts.items():
  29. self.system_facts["ansible_%s" % k.replace('-', '_')] = v
  30. - except UnboundLocalError:
  31. - # ansible-2.2
  32. + except (UnboundLocalError, RuntimeError):
  33. + # ansible-2.2,2.3
  34. self.system_facts = get_all_facts(module)['ansible_facts'] # noqa: F405
  35.  
  36. self.facts = self.generate_facts(local_facts,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement