Added Architect module and makefile rule for engines installation
Change-Id: I462f47d01bd8d2b249ff059a0efd0271929691f7
diff --git a/Makefile b/Makefile
index 1043fbe..8eb30e8 100644
--- a/Makefile
+++ b/Makefile
@@ -40,6 +40,7 @@
cp -a $(FORMULANAME) $(DESTDIR)/$(SALTENVDIR)/
[ ! -d _modules ] || cp -a _modules $(DESTDIR)/$(SALTENVDIR)/
[ ! -d _states ] || cp -a _states $(DESTDIR)/$(SALTENVDIR)/ || true
+ [ ! -d _engines ] || cp -a _engines $(DESTDIR)/$(SALTENVDIR)/ || true
[ ! -d _grains ] || cp -a _grains $(DESTDIR)/$(SALTENVDIR)/ || true
# Metadata
[ -d $(DESTDIR)/$(RECLASSDIR)/service/$(FORMULANAME) ] || mkdir -p $(DESTDIR)/$(RECLASSDIR)/service/$(FORMULANAME)
diff --git a/_modules/architect.py b/_modules/architect.py
new file mode 100644
index 0000000..75878a8
--- /dev/null
+++ b/_modules/architect.py
@@ -0,0 +1,74 @@
+# -*- coding: utf-8 -*-
+'''
+Salt modules to work with the Architect service.
+'''
+
+# Import python libs
+from __future__ import absolute_import
+import yaml
+from architect_client.libarchitect import ArchitectClient
+import logging
+
+__virtualname__ = 'architect'
+
+logger = logging.getLogger(__name__)
+
+
+def __virtual__():
+ return __virtualname__
+
+
+def _client():
+ return ArchitectClient()
+
+
+def get_inventory():
+ '''
+ Get the Architect metadata inventory for given Salt master.
+
+ CLI Examples:
+
+ .. code-block:: bash
+
+ salt-call architect.get_inventory
+ '''
+ data = yaml.load(_client().get_data())
+
+ return data
+
+
+def get_node(name):
+ '''
+ Get the Architect node metadata for given Salt master.
+
+ CLI Examples:
+
+ .. code-block:: bash
+
+ salt-call architect.get_node node.domain
+ '''
+
+ data = yaml.load(_client().get_data(name))
+
+ return {
+ name: data
+ }
+
+
+def collect_minion_info():
+ '''
+ Get Salt minion metadata and forward it to the Architect master.
+
+ CLI Examples:
+
+ .. code-block:: bash
+
+ salt-call architect.collect_minion_info
+ '''
+
+ data = {
+ 'pillar': __salt__['pillar.data'](),
+ 'grain': __salt__['grains.items'](),
+ }
+ output = _client().push_salt_minion({data['grain']['id']: data})
+ return output