Skip to content

Instantly share code, notes, and snippets.

@rbrady
rbrady / nova-log
Created December 16, 2013 19:58
a log file
[stack@localhost ~]$ cat nova.log
Dec 16 16:42:59 localhost nova-api[32737]: 2013-12-16 16:42:59,196.196 32748 DEBUG nova.api.openstack.wsgi [req-0ca85637-afa8-4dba-9515-00a68df13082 b7ba3cf575c148e09ec7c3a56f7de071 d356acee69364d6391c0f88c0f605a5c] No Content-Type provided in request get_body /opt/stack/venvs/nova/lib/python2.7/site-packages/nova/api/openstack/wsgi.py:849
Dec 16 16:42:59 localhost nova-api[32737]: 2013-12-16 16:42:59,197.197 32748 DEBUG nova.api.openstack.wsgi [req-0ca85637-afa8-4dba-9515-00a68df13082 b7ba3cf575c148e09ec7c3a56f7de071 d356acee69364d6391c0f88c0f605a5c] Calling method <bound method KeypairController.index of <nova.api.openstack.compute.contrib.keypairs.KeypairController object at 0x4336310>> _process_stack /opt/stack/venvs/nova/lib/python2.7/site-packages/nova/api/openstack/wsgi.py:976
Dec 16 16:42:59 localhost nova-api[32737]: 2013-12-16 16:42:59,207.207 32748 DEBUG nova.api.openstack.wsgi [req-4358e5e7-4ccc-48b4-8982-ddacd586aab6 b7ba3cf575c148e09ec7c3a56f7de071 d356acee6936
#!/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
#!/usr/bin/env python
import click
import os
from pprint import pprint
import sys
from pygerrit.rest import GerritRestAPI
@click.command()
@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
neutron subnet-update $(neutron subnet-list | grep "-" | awk '{print $2}') --dns-nameserver 8.8.8.8
@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:
@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 / 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_mixins_example.py
Last active March 9, 2017 04:48
Mistral Custom Actions ~ Using Mixins
import abc
class Action(object):
@abc.abstractmethod
def run(self):
pass
@rbrady
rbrady / board_query_snippet.py
Created March 9, 2017 13:49
Board Query Snippet
# check for board existence
board = [b for b in trello_api.list_boards() if b.name == board_name][0]
# if no board, print error and exit
if not board:
click.echo("Trello board not found!")
sys.exit(1)
# create board context
context = {'board': board}