Skip to content

Instantly share code, notes, and snippets.

View ryancurrah's full-sized avatar

Ryan Currah ryancurrah

  • Toronto, Ontario
View GitHub Profile
@ryancurrah
ryancurrah / delete_customers.py
Last active August 29, 2015 14:15
Delete Cloud Cruiser Customers by ID
"""
OS packages required:
1. libxml2-dev (Debian), libxml2-devel (RHEL)
2. libxslt-dev (Debian), libxslt-devel (RHEL)
3. python-dev (Debian), python-devel (RHEL)
Python packages required:
1. lxml
2. requests
@ryancurrah
ryancurrah / cloudifymanager_celeryd_starter.py
Created February 10, 2015 23:38
Start cloudify celeryd services on cloudify manager
#!/usr/bin/python
"""
This script will start services found in the INIT_DIR for Ubuntu or Redhat.
The services found can be filtered by using the SERVICE_STARTS_WITH parameter.
Required services will be started before the services found using the list parameter REQUIRED_SERVICES.
"""
from subprocess import Popen, PIPE
import time
import sys
import threading
@ryancurrah
ryancurrah / cloudifymanager_celeryd_starter.py
Created February 10, 2015 23:39
Start cloudify celeryd services on cloudify clients
#!/usr/bin/python
"""
This script will start services found in the INIT_DIR for Ubuntu or Redhat.
The services found can be filtered by using the SERVICE_STARTS_WITH parameter.
Required services will be started before the services found using the list parameter REQUIRED_SERVICES.
"""
from subprocess import Popen, PIPE
import time
import sys
import threading
@ryancurrah
ryancurrah / ctx.instance.py
Last active August 29, 2015 14:15
Printing Cloudify CTX object attributes using dir.
# CTX Instance
print type(ctx.instance)
<class 'cloudify.context.NodeInstanceContext'>
print dir(ctx.instance)
['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_context', '_endpoint', '_get_node_instance_if_needed', '_get_node_instance_ip_if_needed', '_host_ip', '_modifiable', '_node', '_node_instance', '_relationships', 'host_ip', 'id', 'relationships', 'runtime_properties', 'update']
@ryancurrah
ryancurrah / ccremailer.py
Last active August 29, 2015 14:20
Cloud Cruiser Report Emailer
"""
Cloud Cruiser Report Emailer
This script takes in arguments from the
command line to generate and email Cloud Cruiser reports.
Example usage:
python ccremailer.py --url http://cloudcruiser.mysite.com:8080 --username rcurrah --password mypass --usergroup-name admin --report-name MyReport --email-server smtp.mysite.com --email-from ryan@mysite.com --email-to ryan@mysite.com,david@mysite.com --debug true
"""
import requests
@ryancurrah
ryancurrah / retries.py
Last active August 29, 2015 14:21 — forked from n1ywb/retries.py
#!/usr/bin/env python
#
# Copyright 2012 by Jeff Laughlin Consulting LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@ryancurrah
ryancurrah / file_return.py
Last active September 7, 2015 15:21
Return Salt Job Results to a JSON File
from __future__ import absolute_import
# Import Standard Libs
import logging
import json
import os
# Import Salt Libs
import salt.returners
@ryancurrah
ryancurrah / cloud-config-master.yaml
Last active July 13, 2019 20:54
CoreOS w/ Kubernetes Cloud Config
#cloud-config
#type: master
---
hostname: master01
users:
- name: core
passwd: $6$rounds=4096$qTfXAnCBjkQ326$zRFWfe45s3quKvxl2pax1Ml44PCPNQQYXcJ.r0FfkN5jwecdipepTLMNEQCsAcGJkH5NA6BCPr4VIGJNftBIe.
groups:
- sudo
@ryancurrah
ryancurrah / add-user-to-tenants.py
Last active September 7, 2015 15:17
OpenStack Add User to Multiple Tenants
import getpass
import logging
from keystoneclient.v2_0 import client
from keystoneclient import utils
from keystoneclient.openstack.common.apiclient import exceptions
from argparse import ArgumentParser
logging.basicConfig(format='%(asctime)s %(levelname)s: %(message)s', level=logging.INFO)
@ryancurrah
ryancurrah / check-salt-master.py
Last active September 8, 2015 22:14
Sensu Check Salt Master (test.ping)
import salt.client
from salt.config import apply_minion_config
from argparse import ArgumentParser
from common.sensu import Sensu
sensu = Sensu()
def main():
"""