Skip to content

Instantly share code, notes, and snippets.

View sivy's full-sized avatar

Steve Ivy sivy

View GitHub Profile
['/Users/sivy/Projects/myapp/lib',
'/Users/sivy/Projects/myapp/lib',
'/Users/sivy/Projects/myapp',
'/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine',
'/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webob_1_1_1',
'/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/antlr3',
'/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django_0_96',
'/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/fancy_urllib',
'/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/ipaddr',
'/Applications/GoogleAppEngineLauncher.app/Contents/Resources/Google
======================================================================
ERROR: test.test_admin.TestAdminIndex.test_load_page
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/sivy/.virtualenvs/myapp/lib/python2.7/site-packages/nose/case.py", line 381, in setUp
try_run(self.inst, ('setup', 'setUp'))
File "/Users/sivy/.virtualenvs/myapp/lib/python2.7/site-packages/nose/util.py", line 478, in try_run
return func()
File "/Users/sivy/Projects/myapp/test/test_admin.py", line 22, in setUp
self.loader.load_data()
HOST = os.environ['HTTP_HOST']
# CheckConnect
# basic check ssh connection
# --------------------------------------------------------------
# bulldozer.py imports uberlin.operations.ssh.SSH
mock_can_ssh_patcher = patch('uberlin.bulldozer.SSH.can_ssh',
return_value=True)
self.mock_can_ssh = mock_can_ssh_patcher.start()
self.patchers.append(mock_can_ssh_patcher)
@sivy
sivy / sample_test_mocking_exists.py
Created August 1, 2012 13:05
Trying to use mock.patch() with fabric
from mock import Mock, MagicMock, patch
from django.test import TestCase
from django.contrib.auth.models import User
from app.models import Environment
import app.operations
import app.bulldozer
% ssh [email protected]
...
% cat "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQpW9GApzp7WRL+OOoyJQOYHkmpJL6L0Iw1JsVKnjeSqlbHIQBXpugi9a7RkgrmaN2FrsUP385JwEAAE4rwk..." >> ~/.ssh/authorized_keys
@sivy
sivy / post-update.sh
Created July 9, 2012 15:47
A simple rsync post-update script for Pushcode
#!/bin/sh
#
# post-update.sh for Pushcode
#
# ENVIRONMENT VARIABLES PASSED TO THIS SCRIPT:
#
# $WORKING_DIR: the checkout directory from Pushcode. This is provided
# by Pushcode
#
import simplejson as json
@login_required
def add_to_group(request):
if request.is_ajax():
if request.method == 'POST':
group_relation = ClientGroupClient()
group_relation.client_id = request.POST['client_id']
group_relation.client_group_id = request.POST['group_id']
group_relation.save()
[Thu, 31 May 2012 11:32:08 -0700] INFO: template[/etc/chef/client.rb] sending create action to ruby_block[reload_client_config] (delayed)
[Thu, 31 May 2012 11:32:08 -0700] INFO: Processing ruby_block[reload_client_config] action create (chef-client::config line 48)
[Thu, 31 May 2012 11:32:08 -0700] INFO: ruby_block[reload_client_config] called
[Thu, 31 May 2012 11:32:09 -0700] ERROR: Running exception handlers
[Thu, 31 May 2012 11:32:10 -0700] FATAL: Saving node information to /var/cache/chef/failed-run-data.json
[Thu, 31 May 2012 11:32:10 -0700] ERROR: Exception handlers complete
[Thu, 31 May 2012 11:32:10 -0700] FATAL: Stacktrace dumped to /var/cache/chef/chef-stacktrace.out
[Thu, 31 May 2012 11:32:10 -0700] FATAL: Net::HTTPServerException: 403 "Forbidden"
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
(sprintly)titan[~/PROJECTS/sprint.ly/chef]> python
Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> def linebreak(key="-",length=80):
... print key*length
...
>>> linebreak()
--------------------------------------------------------------------------------
>>> linebreak(key="_")