Created
May 4, 2015 19:52
-
-
Save anonymous/42203948dd06440a7c1c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# vim: set ft=python | |
""" | |
_modules.formula_dict | |
~~~~~~~~~~~~~~~ | |
Description | |
This module contains the functions to make salt.utils.dictupdate.merge | |
available for use in our code. There a lazyloader bug in salt currently | |
so we need this function | |
https://github.com/saltstack/salt/issues/22444 | |
""" | |
# Import python libs | |
from __future__ import absolute_import | |
# Import salt libs | |
from salt.utils import dictupdate | |
__virtualname__ = 'formula_dict' | |
# | |
# Classes and functions | |
# | |
def __virtual__(): | |
""" | |
formula_dict.__virtual__ | |
No deps. Load the module, if we add execution function to this modules | |
please add in logic to this function to make sure the module can be | |
loaded on minions | |
""" | |
return __virtualname__ | |
def merge(dest, upd): | |
""" | |
formula_dict.merge | |
Allows deep merging of dicts so you don't accidentally overwrite stuff | |
""" | |
return dictupdate.update(dest, upd) | |
def get(source, key, default='', delimiter=':'): | |
return salt.utils.traverse_dict_and_list(source, | |
key, | |
default, | |
delimiter) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment