Skip to content

Instantly share code, notes, and snippets.

<f:entry title="Target Type" field="targettype">
<select name="targettype">
<option value="glob">glob</option>
<option value="pcre">pcre</option>
<option value="list">list</option>
<option value="grain">grain</option>
<option value="pillar">pillar</option>
<option value="nodegroup">nodegroup</option>
<option value="range">range</option>
<option value="compound">compund</option>
"return": [
{
"data": {
"stratos.kix": {
"cmd_|-failure_|-echo \"generated problem\" ; exit 5_|-run": {
"__run_num__": 1,
"changes": {
"pid": 16433,
"retcode": 5,
"stderr": "",
{
"info":[
{
"Function":"state.sls",
"jid":"20160219112937439194",
"Target":"stratos.kix",
"Target-type":"glob",
"User":"xian",
"StartTime":"2016, Feb 19 11:29:37.439194",
"Arguments":[
#!/bin/sh
JSON='[{"arg": "docker", "client": "local","expr_form": "glob","fun": "state.sls","tgt": "SOMEHOST", "kwarg": ["test": "True"] }]'
RESPONSE=`curl -ik https://localhost:8000/login -H 'Content-Type: application/json' -d '[{"eauth":"pam","password":"PASSWORD","username":"USERNAME"}]' 2>/dev/null`
TOKEN=`echo $RESPONSE | grep -oP "[[:alnum:]]{40}" | uniq`
RESPONSE=`curl -k https://localhost:8000/ -H 'Accept: application/json' -H "X-Auth-Token: $TOKEN" -H 'Content-Type: application/json' -d "$JSON" 2>/dev/null`
echo $RESPONSE | tr '\n' ' '
echo ""
#!py
import logging
import salt.runner
import salt.client
import salt.config
log = logging.getLogger(__name__)
# -*- coding: utf-8 -*-
'''
A module for testing the logic of states and highstates
:codeauthor: William Cannon <william.cannon@gmail.com>
:maturity: new
Saltcheck provides unittest like functionality requiring only the knowledge of
salt module execution and yaml. Saltcheck uses salt modules to return data, then
runs an assertion against that return. This allows for testing with all the
@mchugh19
mchugh19 / long-job.sh
Created February 18, 2016 19:50
quick salt api curl test
#!/bin/sh
JSON='[{"arg":["sleep 14; echo testing"],"client":"local","expr_form":"glob","fun":"cmd.run","tgt":"*"}]'
RESPONSE=`curl -ik https://localhost:8000/login -H 'Content-Type: application/json' -d '[{"eauth":"pam","password":"SOMEPASSWORD","username":"SOMEUSERNAME"}]' 2>/dev/null`
TOKEN=`echo $RESPONSE | grep -oP "[[:alnum:]]{40}" | uniq`
RESPONSE=`curl -ik https://localhost:8000/minions -H 'Accept: application/json' -H "X-Auth-Token: $TOKEN" -H 'Content-Type: application/json' -d "$JSON" 2>/dev/null`
JID=`echo $RESPONSE | grep -oP "[0-9]{20}" | uniq`
#echo GOT $JID