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 CheckForSpaceHook(BackupHook): | |
"""Check for available space before starting a backup""" | |
job_info = None | |
def execute(self, job, event): | |
"""Estimate the available space from the plugin and abort if | |
there does not appear to be enought to successfully complete this | |
backup based on the estimate. | |
:raises: BackupError if estimated_space > available_space |
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
--- a/plugins/holland.backup.sqlite/holland/backup/sqlite.py | |
+++ b/plugins/holland.backup.sqlite/holland/backup/sqlite.py | |
@@ -11,13 +11,13 @@ LOG = logging.getLogger(__name__) | |
CONFIGSPEC=""" | |
[sqlite] | |
databases = force_list(default=list()) | |
-binary = string(default=/usr/bin/sqlite3) | |
+binary = string(default="/usr/bin/sqlite3") | |
[compression] |
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
====================================================================== | |
ERROR: tests.test_sqlite.test_sqlite_info | |
---------------------------------------------------------------------- | |
Traceback (most recent call last): | |
File "/usr/lib/python2.7/site-packages/nose/case.py", line 186, in runTest | |
self.test(*self.arg) | |
File "/home/abg/projects/holland/plugins/holland.backup.sqlite/tests/test_sqlite.py", line 213, in test_sqlite_info | |
plugin.pre() | |
File "/home/abg/projects/holland/plugins/holland.backup.sqlite/holland/backup/sqlite.py", line 43, in pre | |
self.config['sqlite']['binary'] |
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
--- a/test_runner.py | |
+++ b/test_runner.py | |
@@ -112,12 +112,13 @@ class TestRunner(object): | |
os.chdir(path) | |
if self.report: | |
args = [ | |
- self.nosetests, | |
+ 'python', | |
+ 'setup.py', | |
+ 'nosetests', |
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
" vimrc file for following the coding standards specified in PEP 7 & 8. | |
" | |
" To use this file, source it in your own personal .vimrc file (``source | |
" <filename>``) or, if you don't have a .vimrc file, you can just symlink to it | |
" (``ln -s <this file> ~/.vimrc``). All options are protected by autocmds | |
" (read below for an explanation of the command) so blind sourcing of this file | |
" is safe and will not affect your settings for non-Python or non-C files. | |
" | |
" | |
" All setting are protected by 'au' ('autocmd') statements. Only files ending |
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
#!/usr/bin/python | |
""" | |
python-bottle based MySQL replication monitor. | |
Configuration can be specified via [server.*] and [bottle] directivesin /etc/rack_replmon/monitor.conf. The monitor will parse any entry thatbegins with ^server as directives for a server to scan | |
Valid [server.*] directives: | |
host, port, user, passwd | |
Valid [bottle] directives: | |
host, port |
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 ctypes | |
import datetime | |
c_uint64 = ctypes.c_uint64 | |
class MySQLDT(ctypes.BigEndianStructure): | |
_fields_ = [ | |
("sign", c_uint64, 1), | |
("yearmonth", c_uint64, 17), | |
("day", c_uint64, 5), |
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 operator | |
import struct | |
def unpack_integer(data, size, endian='<'): | |
"""Unpack a MySQL packed integer format | |
Standard MySQL integers are packed in little endian format, | |
but various integers are packed in big endian format - e.g. | |
timestamps and decimal parts. |
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 binascii | |
import collections | |
import re | |
import struct | |
CodeRange = collections.namedtuple('CodeRange', 'start end') | |
class EncodingRule(object): | |
def __init__(self, coderange, pattern, name, initial_code): | |
self.coderange = coderange |
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
""" | |
cli | |
~~~ | |
Simple CLI API | |
@cli.command | |
def mycommand(required_arg, option='default', *varargs): | |
... | |
sys.exit(cli.run()) |
OlderNewer