Created
January 7, 2015 16:46
-
-
Save dnd/3329901fb90feb8dddd4 to your computer and use it in GitHub Desktop.
_grains/environment.py
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
#!/usr/bin/env python | |
import salt.log | |
import salt.utils | |
def environment(): | |
fqdn = salt.utils.network.get_fqhostname() | |
host = fqdn.partition('.')[0] | |
grains = {} | |
environment = __salt__['envutil.infer_env_from_name'](host) | |
grains['environment'] = environment | |
return grains |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment