Skip to content

Instantly share code, notes, and snippets.

@stevearc
stevearc / gen_roster.py
Last active January 11, 2020 22:53
Script for generating a salt-ssh roster from different cloud providers
#!/usr/bin/env python
import os
import argparse
import yaml
class IRosterFactory(object):
""" Interface for objects that can generate a Salt roster """
@simonbaird
simonbaird / create_with_subtype.rb
Created February 8, 2012 02:27
Specify type when creating a record in AR STI
#
# This was causing problems when submitting the nested object form
# in a/v/product/channels_edit because all the nested channels would
# be created at plan Channel objects instead of the PrimaryChannel, EusChannel etc.
#
# In active record normally :type is ignored, eg:
# Channel.create(:type='PrimaryChannel', :etc=>1, ...)
# ignores the type attr and uses 'Channel'.
#
# This hack will make it actually use the :type value.