Skip to content

Instantly share code, notes, and snippets.

View abhishekctn's full-sized avatar

Abhishek Tiwari abhishekctn

  • Cotton On Group
  • Geelong
View GitHub Profile
@abhishekctn
abhishekctn / bootstrap_salt_cloudinit.rst
Created April 29, 2012 03:39 — forked from akoumjian/bootstrap_salt_cloudinit.rst
Bootstrapping Salt on Linux EC2 with CloudInit

Boostrapping Salt on Linux EC2 with Cloud-Init

Salt is a great tool for remote execution and configuration management, however you will still need to bootstrap the daemon when spinning up a new node. One option is to create and save a custom AMI, but this creates another resource to maintain and document.

A better method for Linux machines uses Canonical's CloudInit to run a bootstrap script during an EC2 Instance initialization. Cloud-init takes the user_data string passed into a new AWS instance and runs it in a manner similar to rc.local. The bootstrap script needs to:

  1. Install Salt with dependencies
  2. Point the minion to the master
@abhishekctn
abhishekctn / push_stuck_order.py
Created April 26, 2012 04:24
Push stuck order
import time
from queue.tasks import submit_order_handler
def resave_stuck_orders():
stuck_orders = Order.objects.filter(time__gte="2012-04-16").filter(payment_gateway_transaction_id__isnull=False).filter(has_rms_order_id__exact=False)
for order in stuck_orders:
print "re-saving order: %s\n" % order
order.save()
print "order: %s\n" % order.id
print "starting sleep\n\n"
time.sleep(30)
# From https://bitbucket.org/chris1610/satchmo/src/6d8bb4f0deeb/satchmo/apps/payment/modules/cybersource/
from django.template import Context, loader
from payment.modules.base import BasePaymentProcessor, ProcessorResult
from satchmo_utils.numbers import trunc_decimal
from django.utils.translation import ugettext_lazy as _
import urllib2
try:
from xml.etree.ElementTree import fromstring