Add missing proxy-minion script

This commit is contained in:
C. R. Oldham 2013-12-25 21:08:56 -07:00 committed by C. R. Oldham
parent ae3f78c9a5
commit 1c96911c1a
4 changed files with 88 additions and 0 deletions

View file

@ -0,0 +1,48 @@
Salt Proxy Minion Documentation
===============================
.. toctree::
:maxdepth: 3
:glob:
:hidden:
*
install/index
Proxy minions are a Salt feature that enables controlling devices that, for
whatever reason, cannot run a standard salt-minion. Examples include network
gear that has an API but runs a proprietary OS, devices with limited CPU or
memory, or devices that could run a minion, but for security reasons, will not.
Proxy minions are not, for the most part, an "out of the box" feature. Because
there are a myriad of devices outside the typical Linux or Windows worlds, if
you are trying to control something you will most likely have to write the
interface yourself. Fortunately, this is only as difficult as the actual
interface to the proxied device. Devices that have an existing Python module
(PyUSB for example) would be relatively simple to interface. Code to control
a device that has an HTML REST-based interface should be easy. Code to control
your typical housecat would be excellent source material for a PhD thesis.
Salt-proxy-minions provide the 'plumbing' that allows device enumeration,
control, status, remote execution, and state management.
Getting Started
===============
Minion management
-----------------
Minion Discovery
----------------
Essential Components of a Proxy Minion Interface
------------------------------------------------
* Configuration file parameters
* The __proxyenabled__ directive
* test.ping

0
salt/proxy/__init__.py Normal file
View file

26
salt/proxy/junos.py Normal file
View file

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
'''
Routines to set up a minion
'''
# Import python libs
import logging
import os
import jnpr.junos
import jnpr.junos.utils
import jnpr.junos.cfg
HAS_JUNOS = True
def proxyconn(user=None, host=None, passwd=None):
jdev = jnpr.junos.Device(user=user, host=host, password=passwd)
jdev.open()
jdev.bind(cu=jnpr.junos.utils.Config)
return jdev
def proxytype():
return 'junos'
def id(opts):
return opts['proxyconn'].facts['hostname']

14
scripts/salt-proxy-minion Executable file
View file

@ -0,0 +1,14 @@
#!/usr/bin/env python
'''
This script is used to kick off a salt proxy-minion daemon
'''
from salt.scripts import proxy_minion
from multiprocessing import freeze_support
if __name__ == '__main__':
# This handles the bootstrapping code that is included with frozen
# scripts. It is a no-op on unfrozen code.
freeze_support()
proxy_minion()