Skip to content

Instantly share code, notes, and snippets.

@jlaska
jlaska / delete_jenkins_jobs.py
Created July 25, 2012 14:40
Delete jenkins jobs matching a provided regular expression
#!/usr/bin/python
import sys
import os
import optparse
import getpass
import re
import xml.dom.minidom
try:
import jenkinsapi.jenkins
@jlaska
jlaska / ovirt-cli.py
Created April 29, 2013 17:36
oVirt CLI - A python-based command-line interface to ovirtsdk-engine
#!/usr/bin/env python
import sys
import argparse
from ovirtsdk.api import API
from ovirtsdk.xml import params
# Base object
# =================================================
class Cmd_Base(object):
@jlaska
jlaska / listener.py
Last active March 4, 2016 22:39
Demonstrate py.test integration with python-bottle API
#!/usr/bin/env python
# parse API get requests from CFME automate
# requires:
# * python 'bottle'
# * port 8080 open
# example: curl -X PUT http://localhost:8080/events/redhat/vm?event=power_on_vm
import os
import sys
@jlaska
jlaska / site_facts
Created June 11, 2013 18:03
ansible/site_facts Make yum repository configuration available to ansible playbooks using the following site_facts.
#!/usr/bin/env python
import json
import os
import yum
def main():
module = AnsibleModule(
argument_spec = dict(
yum_conf=dict(required=False,
@jlaska
jlaska / inventory
Created July 12, 2013 12:40
Reproducer for ansible issue #3504
[local]
127.0.0.1 ansible_connection=local
@jlaska
jlaska / ec2.patch
Created November 1, 2013 16:49
[ansible/library/cloud/ec2] Support wait on terminate and enable tag idempotency
--- library/cloud/ec2 2013-11-01 07:44:09.000000000 -0400
+++ library/cloud/ec2 2013-11-01 08:40:04.000000000 -0400
@@ -34,6 +34,12 @@
required: false
default: null
aliases: []
+ idempotency_attribute:
+ description:
+ - Specify an alternative attribute to enforce idempotency.
+ required: false
@jlaska
jlaska / test_scenario.py
Created November 14, 2013 21:37
Pytest plugin to enable test scenarios. A test scenario is a series of related tests where sequential successful execution is important.
import py
import pytest
'''
Automatically xfail remaining tests if previous test failed. Tests will
continue to run if:
* the result is skip
* the result is xfail
* the test is marked as nondestructive
@jlaska
jlaska / ansible-galaxy.patch
Last active December 31, 2015 19:19
Prevent ansible-galaxy from init'ing if the desired role contains any ROLE_FILES
diff --git a/bin/ansible-galaxy b/bin/ansible-galaxy
index 7593181..1d99c4c 100755
--- a/bin/ansible-galaxy
+++ b/bin/ansible-galaxy
@@ -445,6 +445,7 @@ def execute_init(args, options):
init_path = get_opt(options, 'init_path', './')
api_server = get_opt(options, "api_server", "galaxy.ansibleworks.com")
force = get_opt(options, 'force', False)
+ ROLE_DIRS = ('defaults','files','handlers','meta','tasks','templates','vars')
@jlaska
jlaska / assemble_inventory.py
Created January 16, 2014 15:41
Convenience script to assemble inventory artifacts from a Jenkins matrix job
#!/usr/bin/env python
import sys
import requests
import StringIO
from ConfigParser import SafeConfigParser, RawConfigParser, ConfigParser
user = 'FIXME'
password = 'FIXME'
base_url = 'http://50.116.42.103/'
---
skip_delete: True