Skip to content

Instantly share code, notes, and snippets.

@rbrady
rbrady / mistral_base_classes_usage_example.py
Last active March 9, 2017 03:54
Mistral Custom Actions ~ With Base Classes (Usage)
import base
class MyCustomAction(base.Action):
def run(self):
return "I ran"
class MyAsyncAction(base.AsyncAction):
@rbrady
rbrady / mistral_base_classes_example.py
Last active March 9, 2017 17:20
Mistral Custom Actions ~ Using Base Classes
import abc
class Action(object):
@abc.abstractmethod
def run(self):
pass
@rbrady
rbrady / decorator-secret-syntax.py
Created March 2, 2017 14:14
Proposed Syntax to Protect Sensitive Data in Custom Actions
from mistral_lib import actions
from mistral_lib.security import secret
class MyCustomAction(actions.Action):
@secret(['password'])
def __init__(self, username, password):
self.username = username
self.password = password
@rbrady
rbrady / workflow-secret-syntax.yaml
Last active March 2, 2017 14:09
Proposed Syntax to Protect Sensitive Data in Workflows
version: "2.0"
wf:
input:
- username
secret:
- password
tasks:
taskA:
action: my_action
publish:
neutron subnet-update $(neutron subnet-list | grep "-" | awk '{print $2}') --dns-nameserver 8.8.8.8
@rbrady
rbrady / screencast.py
Last active August 18, 2016 04:57
A half-baked idea to make it easier to have a repeatable screencast process
# Copyright 2016 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
#!/usr/bin/env python
import click
import os
from pprint import pprint
import sys
from pygerrit.rest import GerritRestAPI
@click.command()
#!/bin/bash
set -eu
set -o pipefail
exec_ids=$(mistral execution-list | awk -F "| " '{print $2; }')
for exec_id in $exec_ids; do
if [ ! $exec_id = "ID" ]; then
mistral execution-delete $exec_id
fi
done
# Copyright 2015 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@rbrady
rbrady / dan.py
Last active November 4, 2015 15:48
import argparse
import csv
import os
import sys
def parse_opts(argv):
parser = argparse.ArgumentParser(
description='Transform a csv file to desired formatting for '
'dumb proprietary software that does not use a well'