Skip to content

Instantly share code, notes, and snippets.

View portante's full-sized avatar

Peter Portante portante

View GitHub Profile
diff --git a/swift/common/swob.py b/swift/common/swob.py
index 37e0a6b..8abba26 100644
--- a/swift/common/swob.py
+++ b/swift/common/swob.py
@@ -1162,7 +1162,11 @@ class Response(object):
"""
Attempt to construct an absolute location.
"""
- if not self.location.startswith('/'):
+ if not self.location or not self.host_url \
@portante
portante / gist:8726954
Created January 31, 2014 05:20
The beginnings of an infinite loop created when the /dev/log file is yanked out from underneath the facility, and sys.stderr/stdout is replaced with a file object that uses a logger referencing /dev/log.
Traceback (most recent call last):
File "/opt/stack/old/swift/bin/swift-proxy-server", line 22, in <module>
run_wsgi(conf_file, 'proxy-server', default_port=8080, **options)
File "/opt/stack/old/swift/swift/common/wsgi.py", line 302, in run_wsgi
pid, status = os.wait()
File "/opt/stack/old/swift/swift/common/wsgi.py", line 281, in hup
logger.error('SIGHUP received')
File "/usr/lib/python2.7/logging/__init__.py", line 1436, in error
self.logger.error(msg, *args, **kwargs)
File "/usr/lib/python2.7/logging/__init__.py", line 1166, in error
@portante
portante / Eventlet canonical yield analysis
Last active August 29, 2015 13:55
This is UNVERIFIED. Need to mock time.time for Eventlet to verify.
Analysis of Eventlet sleep(0) yields and its implications
=========================================================
Author:
Date: 2014-02-02 23:53:11 EST
Table of Contents
=================
1 Summary
@portante
portante / keybase.md
Created May 18, 2014 15:33
I sign therefore I am?

Keybase proof

I hereby claim:

  • I am portante on github.
  • I am portante (https://keybase.io/portante) on keybase.
  • I have a public key whose fingerprint is E76C 2560 32D5 311D 5E68 BCD4 213D 5E2F BA81 C413

To claim this, I am signing this object:

@portante
portante / tests.py.diff
Last active August 29, 2015 14:02
Simple patch so that failing unit tests with missing storage polices don't instead report versioning not enabled
diff --git a/test/functional/tests.py b/test/functional/tests.py
index b52082c..16f49bd 100644
--- a/test/functional/tests.py
+++ b/test/functional/tests.py
@@ -2087,7 +2087,12 @@ class TestCrossPolicyObjectVersioningEnv(object):
cls.multiple_policies_enabled = True
else:
cls.multiple_policies_enabled = False
- cls.versioning_enabled = False
+ # We have to lie here that versioning is enabled. We actually
diff --git a/swift/common/middleware/keystoneauth.py b/swift/common/middleware/keystoneauth.py
index fb15195..d5e3fb0 100644
--- a/swift/common/middleware/keystoneauth.py
+++ b/swift/common/middleware/keystoneauth.py
@@ -181,20 +181,20 @@ class KeystoneAuth(object):
return None
def authorize(self, env_identity, req):
- tenant_id, tenant_name = env_identity['tenant']
- user_id, user_name = env_identity['user']
@portante
portante / sp-obj-srv-stack-trace.txt
Created June 12, 2014 21:32
Stack trace with storage policies from a probe test run where the object servers are returning 503s.
Jun 12 17:21:25 dhcp31-105 object-server: ERROR __call__ error with PUT /sdb1/617/AUTH_test/container-1824d0bb-f90d-42c4-8517-de7f8632bf25/object-b40d90d1-222c-4a91-83fc-445c5c66be35 :
Traceback (most recent call last):
File "/home/pportant/swift/swift/obj/server.py", line 678, in __call__
res = method(req)
File "/home/pportant/swift/swift/common/utils.py", line 2366, in wrapped
return func(*a, **kw)
File "/home/pportant/swift/swift/common/utils.py", line 970, in _timing_stats
resp = func(ctrl, *args, **kwargs)
File "/home/pportant/swift/swift/obj/server.py", line 459, in PUT
device)
@portante
portante / 0001-Bring-storage-policy-module-coverage-to-100.patch
Created June 16, 2014 20:12
A patch to bring test coverage of storage policies module to 100% from just running it's test module only.
From 981b623a5f0f08a6840437fb0015dd668855ec95 Mon Sep 17 00:00:00 2001
From: Peter Portante <[email protected]>
Date: Mon, 16 Jun 2014 16:07:20 -0400
Subject: [PATCH] Bring storage policy module coverage to 100%
A simple set of additional tests to ensure coverage of the storage policy
module is 100% from just running it's module test.
Change-Id: Id5773438c297678bcfe53e959bc9eb132170d30b
---
@portante
portante / skip-on-no-container-reconciler.diff
Created June 17, 2014 03:24
A simple patch to skip a set of probe tests when there is no container-reconciler.conf file present.
diff --git a/test/probe/test_container_merge_policy_index.py b/test/probe/test_container_merge_policy_index.py
index 5a5054c..b44ecc3 100644
--- a/test/probe/test_container_merge_policy_index.py
+++ b/test/probe/test_container_merge_policy_index.py
@@ -175,7 +175,11 @@ class TestContainerMergePolicyIndex(unittest.TestCase):
def setUp(self):
if len(POLICIES) < 2:
- raise SkipTest()
+ raise SkipTest("Multiple storage policies not present")
@portante
portante / keystonev3_suggested.diff
Created July 17, 2014 14:56
A simple suggestion for formatting long lines.
diff --git a/swiftclient/client.py b/swiftclient/client.py
index 8bb1ded..1807526 100644
--- a/swiftclient/client.py
+++ b/swiftclient/client.py
@@ -309,25 +309,21 @@ version 1.0 which requires ST_AUTH, ST_USER, and ST_KEY environment
variables to be set or overridden with -A, -U, or -K.''')
try:
- _ksclient = ksclient.Client(username=user,
- password=key,