Skip to content

Instantly share code, notes, and snippets.

@rmyers
rmyers / mock_server.py
Last active December 4, 2018 16:00
Mock Server for Django Integration Tests
import httplib
import multiprocessing
import os
import re
from collections import defaultdict
from wsgiref.simple_server import make_server
from django.core.handlers.wsgi import WSGIHandler
from django.http import HttpResponse
@rmyers
rmyers / Jenkinsfile
Last active February 28, 2018 17:57
def checkoutPR () {
checkout([
$class: 'GitSCM',
branches: [[name: 'master']],
extensions: [
[$class: 'CheckoutOption'],
[$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: true]
],
userRemoteConfigs: [[
url: 'https://github.com/racker/reach',
@rmyers
rmyers / aws.py
Created July 28, 2017 15:16
Generate a list of ddi's to add to a flag
#!/usr/bin/env python
#
# Generate a list of flags for a set of customer DDI's from a csv file.
#
# Usage:
# python aws.py ddi_file.csv
import sys
import json
@rmyers
rmyers / stack
Created March 7, 2017 14:48
GUI/API stack for OR
#!/bin/bash -l
YELLOW='\033[1;33m'
PURPLE='\033[1;35m'
GREEN='\033[1;32m'
RED='\033[1;31m'
CYAN='\033[1;36m'
NC='\033[0m'
function f_info() {
@rmyers
rmyers / Vagrantfile
Last active February 28, 2017 18:28
OR Devtools Vagrant
$script = <<SCRIPT
##!/usr/bin/env bash
#
# GLOBAL VARIABLES
#
YELLOW='\033[1;33m'
PURPLE='\033[1;35m'
GREEN='\033[1;32m'
RED='\033[1;31m'
@rmyers
rmyers / taskmanager.py
Created March 23, 2016 00:52
Fix for catching exceptions in fake taskmanager
import eventlet
from trove.taskmanager import api
from trove.taskmanager.manager import Manager
+from trove.openstack.common import log as logging
+
+LOG = logging.getLogger(__name__)
class FakeApi(api.API):
@@ -35,7 +38,10 @@ class FakeApi(api.API):
@rmyers
rmyers / gist:3557ab252dac9be369b4
Created October 20, 2015 17:41
Ha Replica detach
ck.data.database.Instance.prototype.detach = function () {
var haGroup;
if (this.isHaGroupMember()) {
haGroup = new ck.data.database.HaGroup({id: this.get('ha_id')});
haGroup.setProvider(this.getProvider());
haGroup.detach(this.id());
} else {
this.getStore().detach(this.id());
}
@rmyers
rmyers / gist:8006867
Created December 17, 2013 15:37
Cyclomatic Complexity of Trove
$ pip install radon
$ radon cc -anc trove
trove/tests/util/__init__.py
F 84:0 create_dbaas_client - C
trove/tests/unittests/util/matchers.py
M 376:4 XMLMatches._compare_node - C
M 63:4 DictMatches.match - C
trove/taskmanager/models.py
M 144:4 FreshInstanceTasks.create_instance - C
trove/openstack/common/config.py
@rmyers
rmyers / base_trove_guest.conf
Created November 27, 2013 16:17
Guest template refactor
[DEFAULT]
# Show more verbose log output (sets INFO log level output)
verbose = True
# Show debugging output in logs (sets DEBUG log level output)
debug = True
# Address to bind the API server
bind_host = 0.0.0.0
@rmyers
rmyers / backup.py
Created November 26, 2013 15:19
Backup agent changes
def execute_backup(self, context, backup_id, runner=RUNNER):
### snip
###
runner_opts = CONF.backup_runner_opts
extra_opts = runner_opts.get(runner.backup_type, '')
try: