Add ping function

This commit is contained in:
C. R. Oldham 2015-10-21 13:04:27 -06:00
parent 1085eeab2b
commit 3e05437f15
2 changed files with 50 additions and 0 deletions

37
salt/grains/fx2.py Normal file
View file

@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
'''
Generate baseline proxy minion grains
'''
from __future__ import absolute_import
import salt.utils
__proxyenabled__ = ['rest_sample']
__virtualname__ = 'rest_sample'
def __virtual__():
if not salt.utils.is_proxy():
return False
else:
return __virtualname__
def kernel():
return {'kernel': 'proxy'}
def os():
return {'os': 'RestExampleOS'}
def location():
return {'location': 'In this darn virtual machine. Let me out!'}
def os_family():
return {'os_family': 'proxy'}
def os_data():
return {'os_data': 'funkyHttp release 1.0.a.4.g'}

View file

@ -51,6 +51,19 @@ def init(opts):
return False
def ping(opts):
'''
Required.
Ping the device on the other end of the connection
'''
try:
out, err = DETAILS['server'].sendline('help')
return True
except TerminalException as e:
log.error(e)
return False
def shutdown(opts):
'''
Disconnect