This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print 'FOO' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from trove.guestagent.strategies.backup import base | |
from eventlet.green import subprocess | |
class CassandraDump(base.BackupRunner): | |
""" Implementation of Backup Strategy for CassandraDump """ | |
__strategy_name__ = 'cassandradump' | |
# The '-' will redirect the output to stdout for streaming | |
cmd = ('sudo tar cpfP - ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Externalization of heat template | |
Reasons: preparing trove to support multi-datastores | |
Changes: template loading, heat-support update | |
This refactors the earlier code of instance creation using heat. | |
- Reorganize templates by datastore | |
- Config: trove/templates/<datastore_type>/config.template | |
- Heat: trove/templates/<datastore_type>/heat.template | |
- New parameter - ImageId |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
from troveclient import auth | |
from troveclient import client | |
with_trove = True | |
except ImportError: | |
try: | |
from troveclient.compat import auth | |
from troveclient.compat import client | |
with_trove = True | |
except ImportError: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
class DebianPackagerMixin: | |
def boo(self): | |
print('debian') | |
class RedhatPackagerMixin: | |
def boo(self): | |
print('redhat') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DatabaseModelBase(models.ModelBase):¬ | |
_auto_generated_atts = ['id'] | |
¬ | |
@classmethod¬ | |
def create(cls, **values):¬ | |
values = cls.get_auto_generated_values(**values)¬ | |
if hasattr(cls, 'deleted') and 'deleted' not in values:¬ | |
values['deleted'] = False¬ | |
values['created'] = utils.utcnow()¬ | |
instance = cls(**values).save()¬ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def gen(): | |
print 'foo' | |
class Test(object): | |
@classmethod | |
def _uuid(cls): | |
return gen() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env python2.6 | |
""" | |
Manual Backup Script | |
==================== | |
This script is called by the agent to run a backup and stream to swift. | |
Setup Requires: | |
* Python >= 2.6 | |
* Requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import struct | |
import SocketServer | |
from base64 import b64encode | |
from hashlib import sha1 | |
from mimetools import Message | |
from StringIO import StringIO | |
class WebSocketsHandler(SocketServer.StreamRequestHandler): | |
magic = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Build a virtual environment suitable for running appengine. | |
# This uses virtualenvwrapper to make the virtual environment. | |
# Which you can activate with 'workon appengine' | |
# | |
# Everyone loves one-liners! | |
# Mac one-liner: | |
# $ curl -s https://raw.github.com/gist/2839803 | bash | |
# |