Skip to content

Instantly share code, notes, and snippets.

@derks
derks / gist:972511
Created May 14, 2011 19:03
scripts/mkvirtenv.py busted on OSX
derks-macbook [holland] $ ./scripts/mkvirtenv.py
New python executable in /Users/wdierkes/holland-test/bin/python
Installing setuptools............................done.
[INFO] Installed holland-core.
[INFO] Installing holland plugins
[INFO] Installed plugin holland.lib.common
[INFO] Installed plugin holland.lib.mysql
[INFO] Installed plugin holland.lib.lvm
[INFO] Installed plugin holland.backup.mysqldump
[INFO] Installed plugin holland.backup.mysql_lvm
@derks
derks / gist:972616
Created May 14, 2011 20:48
holland bk (path issues)
(holland-test)derks-macbook [~] $ holland bk
2011-05-14 15:46:40,578 [INFO] Backup: default
2011-05-14 15:46:40,619 [INFO] + Found plugin mysqldump
2011-05-14 15:46:40,619 [INFO] + Locked spool /Users/wdierkes/holland-test/backups/default/.holland
2011-05-14 15:46:40,619 [INFO] + Initialized backup directory /Users/wdierkes/holland-test/backups/default/20110514_154640.cAJ5xe
2011-05-14 15:46:40,620 [INFO] + Running setup-backup hooks
2011-05-14 15:46:40,620 [INFO] + Configured plugin
2011-05-14 15:46:40,620 [INFO] + Running backup failure hooks
2011-05-14 15:46:40,620 [INFO] Unexpected exception while running command "bk"
Traceback (most recent call last):
======================================================================
FAIL: tests.core.test_util.test_diskfree
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/Cellar/python/2.7.1/lib/python2.7/site-packages/nose-1.0.0-py2.7.egg/nose/case.py", line 187, in runTest
self.test(*self.arg)
File "/Users/wdierkes/devel/holland/tests/core/test_util.py", line 99, in test_diskfree
assert_equals(path.disk_free("/"), actual_bytes)
AssertionError: 199717908480 != 199717769216
'199717908480 != 199717769216' = '%s != %s' % (safe_repr(199717908480), safe_repr(199717769216))
======================================================================
ERROR: tests.cli.test_cmds.test_cmd_backup
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/Cellar/python/2.7.1/lib/python2.7/site-packages/nose-1.0.0-py2.7.egg/nose/case.py", line 187, in runTest
self.test(*self.arg)
File "/Users/wdierkes/devel/holland/tests/cli/test_cmds.py", line 60, in test_cmd_backup
dry_run=True)
File "/Users/wdierkes/devel/holland/holland/cli/cmd/builtin/cmd_backup.py", line 74, in run_backup
config = self.config.load_backupset(name)
The simple hello world, though it doesn't output anything.
###
from cement2.core import foundation
app = foundation.lay_cement('helloworld')
app.run()
###
What the framework is doing:
class UserResource(ModelResource):
class Meta:
queryset = db.User.objects.all()
authentication = ApiKeyPlusWebAuthentication()
authorization = DjangoAuthorization()
resource_name = 'user'
excludes = ['email', 'password', 'is_active', 'is_staff', 'is_superuser']
filtering = {}
allowed_methods = ['get']
@derks
derks / gist:2506009
Created April 27, 2012 05:01
cement2 + drest
import drest
from cement2.core import foundation, controller
class VTController(controller.CementBaseController):
class Meta:
label = 'base'
arguments = [
( ['-f', '--foo'], dict(help='foo option', dest='foo'))
]
from cement.core import hook
def add_db_object(app):
# setup your database object here, note you can
# get database config settings from app.config.get()
my_db_object = WhateverYourDatabaseIs()
app.extend('db', my_db_object)
hook.register('pre_run', add_db_object)
00:07:00 root:~# groupadd rkt
groupadd: group 'rkt' already exists
00:07:16 root:~# rkt install
rkt directory structure successfully created.
00:07:23 root:~# rkt status ec73bd12
state=running
networks=default:ip4=172.16.28.3
Unable to print status: unable to read status directory: unable to open directory: unable to open file: no such file or directory
oot@openstack:/opt/openstack-ansible/playbooks# openstack-ansible setup-openstack.yml
Variable files: "-e @/etc/openstack_deploy/user_secrets.yml -e @/etc/openstack_deploy/user_variables.yml "
ERROR! the role 'ceph_client' was not found in /opt/openstack-ansible/playbooks/common-playbooks/roles:/etc/ansible/roles:/opt/openstack-ansible/playbooks/roles:/etc/ansible/roles/ceph-ansible/roles:/opt/openstack-ansible/playbooks/common-playbooks
The error appears to have been in '/etc/ansible/roles/os_glance/tasks/main.yml': line 66, column 11, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
include_role: