Skip to content
Browse files

move holland.backup.{sqlite,random} to example plugin package

  • Loading branch information...
1 parent 7d8b062 commit 7f949970df5a820d5922460f6afa15f27c4481e8 @abg committed
View
0 plugins/holland.backup.sqlite/LICENSE → plugins/example/LICENSE
File renamed without changes.
View
0 plugins/holland.backup.sqlite/README → plugins/example/README
File renamed without changes.
View
0 ....backup.sqlite/holland/backup/__init__.py → plugins/example/holland/__init__.py
File renamed without changes.
View
0 ...holland.backup.sqlite/holland/__init__.py → plugins/example/holland/example/__init__.py
File renamed without changes.
View
0 ...nd.backup.random/holland/backup/random.py → plugins/example/holland/example/random.py
File renamed without changes.
View
0 ...nd.backup.sqlite/holland/backup/sqlite.py → plugins/example/holland/example/sqlite.py
File renamed without changes.
View
0 plugins/holland.backup.sqlite/setup.cfg → plugins/example/setup.cfg
File renamed without changes.
View
3 plugins/holland.backup.sqlite/setup.py → plugins/example/setup.py
@@ -24,7 +24,8 @@
],
entry_points="""
[holland.backup]
- sqlite = holland.backup.sqlite:SQLitePlugin
+ sqlite = holland.example.sqlite:SQLitePlugin
+ random = holland.example.random:RandomPlugin
""",
namespace_packages=['holland', 'holland.backup'],
)
View
0 ...s/holland.backup.sqlite/tests/__init__.py → plugins/example/tests/__init__.py
File renamed without changes.
View
0 ...land.backup.sqlite/tests/example_data.sql → plugins/example/tests/example_data.sql
File renamed without changes.
View
0 ...olland.backup.sqlite/tests/test_sqlite.py → plugins/example/tests/test_sqlite.py
File renamed without changes.
View
17 plugins/holland.backup.random/LICENSE
@@ -1,17 +0,0 @@
-
-Mysqldump Plugin for the Holland Backup Framework
-Copyright (C) 2008-2010 Rackspace US, Inc.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License along
-with this program; if not, write to the Free Software Foundation, Inc.,
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
View
7 plugins/holland.backup.random/README
@@ -1,7 +0,0 @@
-Random Backup Plugin
-
-This plugin backs up random data from /dev/random. It is meant to be used as a
-practical example of a real, albeit simple, plugin.
-
-For more information please consult the holland manual or visit the holland
-wiki at http://hollandbackup.org.
View
1 plugins/holland.backup.random/holland/__init__.py
@@ -1 +0,0 @@
-__import__('pkg_resources').declare_namespace(__name__)
View
1 plugins/holland.backup.random/holland/backup/__init__.py
@@ -1 +0,0 @@
-__import__('pkg_resources').declare_namespace(__name__)
View
30 plugins/holland.backup.random/setup.py
@@ -1,30 +0,0 @@
-from setuptools import setup, find_packages
-
-version = '1.1.0'
-
-setup(name='holland.backup.random',
- version=version,
- description=" Back up random useless crap!",
- long_description="""\
- Uses /dev/random. A bit more of an example then holland.backup.example
- """,
- classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
- keywords='random',
- author='Rackspace',
- author_email='holland-devel@googlegroups.com',
- url='http://www.hollandbackup.org/',
- license='GPLv2',
- packages=find_packages(exclude=['ez_setup', 'examples', 'tests',
- 'tests.*']),
- include_package_data=True,
- zip_safe=True,
- test_suite='tests',
- install_requires=[
- # -*- Extra requirements: -*-
- ],
- entry_points="""
- [holland.backup]
- random = holland.backup.random:RandomPlugin
- """,
- namespace_packages=['holland', 'holland.backup'],
- )
View
0 plugins/holland.backup.random/tests/__init__.py
No changes.
View
130 plugins/holland.backup.random/tests/test_random.py
@@ -1,130 +0,0 @@
-
-import os
-import time
-import shutil
-import tempfile
-import copy
-from nose.tools import ok_, eq_, assert_equals, with_setup, raises
-
-from holland.core import load_plugin, BackupError
-from holland.core.config import Config, Configspec
-from holland.core.backup.job import BackupJob
-from holland.backup.random import RandomPlugin
-from holland.lib.which import which, WhichError
-
-spec = Configspec.from_string("""
-[holland:backup]
-plugin = string
-
-backups-to-keep = integer
-auto-purge-failures = string
-purge-policy = string
-estimated-size-factor = float
-estimation-method = string
-retention-count = integer
-
-[random]
-bytes = integer
-
-""")
-
-test_config = Config.from_string("""
-[holland:backup]
-plugin = random
-
-backups-to-keep = 1
-auto-purge-failures = yes
-purge-policy = after-backup
-estimated-size-factor = 1.0
-estimation-method = plugin
-retention-count = 1
-
-[random]
-bytes = 2048
-
-""")
-
-test_config = spec.validate(test_config)
-test_config['holland:backup']['hooks'] = []
-
-class FakeSpool(object):
- def __init__(self, backups):
- self.backups = backups
-
-
- def purge(self, name, retention_count):
- for backup in self.backups:
- backup.purge()
-
- return [], [], self.backups
-
-class FakeStore(object):
- name = 'fake'
-
- def __init__(self):
- self.purged = False
- self.path = tempfile.mkdtemp()
- self.spool = FakeSpool([self])
-
- def oldest(self, n=1):
- return []
-
- def spool_capacity(self):
- return 32*1024**2
-
- def size(self):
- return 0
-
- def purge(self):
- "Fake purge"
- import shutil
- shutil.rmtree(self.path)
- self.purged = True
-
-def setup_func():
- "set up test fixtures"
- test_config['tmpdir'] = tempfile.mkdtemp()
-
-def teardown_func():
- "tear down test fixtures"
- if os.path.exists(test_config['tmpdir']):
- shutil.rmtree(test_config['tmpdir'])
-
-@with_setup(setup_func, teardown_func)
-def test_random_dry_run():
- plugin = load_plugin('holland.backup', 'random')
- #plugin.configure(test_config)
-
- job = BackupJob(plugin, test_config, FakeStore())
- job.run(dry_run=True)
-
-@with_setup(setup_func, teardown_func)
-def test_random_backup():
- plugin = load_plugin('holland.backup', 'random')
- plugin.configure(test_config)
- ok_(plugin.configspec())
- job = BackupJob(plugin, test_config, FakeStore())
- job.run(dry_run=False)
-
-@raises(BackupError)
-@with_setup(setup_func, teardown_func)
-def test_random_backup_bad_directory():
- plugin = load_plugin('holland.backup', 'random')
- plugin.configure(test_config)
-
- job = BackupJob(plugin, test_config, FakeStore())
- job.run(dry_run=True)
- job.plugin.backup_directory = '/path/to/some/bogus/dir'
- job.plugin.backup()
-
-@with_setup(setup_func, teardown_func)
-def test_random_configspec():
- plugin = load_plugin('holland.backup', 'random')
- plugin.configure(test_config)
- ok_(plugin.configspec())
-
-@with_setup(setup_func, teardown_func)
-def test_random_plugin_info():
- plugin = load_plugin('holland.backup', 'random')
- plugin.configure(test_config)
- eq_(plugin.plugin_info().get('name', None), 'random')

0 comments on commit 7f94997

Please sign in to comment.
Something went wrong with that request. Please try again.