Merge pull request #20 from atengler/policy-grain
Policy grain
diff --git a/_grains/nova_policy.py b/_grains/nova_policy.py
new file mode 100644
index 0000000..dc3d1d0
--- /dev/null
+++ b/_grains/nova_policy.py
@@ -0,0 +1,15 @@
+#!/usr/bin/env python
+import salt.config
+import salt.loader
+
+
+def main():
+ path = "/etc/nova/policy.json"
+ __opts__ = salt.config.minion_config('/etc/salt/minion')
+ keystone_policy_mod = salt.loader.raw_mod(__opts__, 'keystone_policy', None)
+ if keystone_policy_mod:
+ result = keystone_policy_mod['keystone_policy.rule_list'](path)
+ if result and 'Error' not in result:
+ return {'nova_policy': result}
+ return {}
+