Bladeren bron

Added Architect module and makefile rule for engines installation

Change-Id: I462f47d01bd8d2b249ff059a0efd0271929691f7
pull/73/head
Ales Komarek 6 jaren geleden
bovenliggende
commit
ef0eea36b1
2 gewijzigde bestanden met toevoegingen van 75 en 0 verwijderingen
  1. +1
    -0
      Makefile
  2. +74
    -0
      _modules/architect.py

+ 1
- 0
Makefile Bestand weergeven

@@ -40,6 +40,7 @@ install:
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)

+ 74
- 0
_modules/architect.py Bestand weergeven

@@ -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

Laden…
Annuleren
Opslaan