Skip to content

Instantly share code, notes, and snippets.

View hub-cap's full-sized avatar

Michael Basnight hub-cap

View GitHub Profile
Arc/Ark
Argo
BeeHive
Bookmark
Cask
Cellar
Cooper
Copernicus
Cosmo
Cuparious
diff --git a/reddwarf/extensions/mysql/service.py b/reddwarf/extensions/mysql/service.py
index d81a715..95daaff 100644
--- a/reddwarf/extensions/mysql/service.py
+++ b/reddwarf/extensions/mysql/service.py
@@ -123,6 +123,9 @@ class UserController(wsgi.Controller):
LOG.info(_("req : '%s'\n\n") % req)
context = req.environ[wsgi.CONTEXT_KEY]
username, host = unquote_user_host(id)
+ # Unquote user/host since dots are valid
+ username = username.replace("\\.", ".")
def unquote_user_host(user_hostname):
unquoted = unquote(user_hostname)
if '@' not in unquoted:
- return unquoted, '%'
- if unquoted.endswith('@'):
- return unquoted, '%'
- splitup = unquoted.split('@')
- host = splitup[-1]
- user = '@'.join(splitup[:-1])
+ user, host = unquoted, '%'
--- a/reddwarf/extensions/mysql/common.py
+++ b/reddwarf/extensions/mysql/common.py
@@ -52,7 +52,7 @@ def populate_users(users):
def unquote_user_host(user_hostname):
- unquoted = unquote(user_hostname)
+ unquoted = unquote(user_hostname).replace("\\.", ".")
if '@' not in unquoted:
return unquoted, '%'
diff --git a/reddwarf/extensions/mysql/common.py b/reddwarf/extensions/mysql/common.py
index b4059ff..f46f465 100644
--- a/reddwarf/extensions/mysql/common.py
+++ b/reddwarf/extensions/mysql/common.py
@@ -52,7 +52,7 @@ def populate_users(users):
def unquote_user_host(user_hostname):
- unquoted = unquote(user_hostname)
+ unquoted = unquote(user_hostname).replace(r'\.', '.')
>>> ephemeral_support = None
>>> if ephemeral_support and 1 == 1:
... print foo
...
>>> ephemeral_support = "/some/device/path"
>>> if ephemeral_support and 1 == 1:
... print "foo"
...
foo
GROUP = "dbaas.api.action_events"
@test(depends_on_classes=[WaitForGuestInstallationToFinish],
groups=[GROUP])
class ValidateActionEvents(object):
@test
def test_validate_create_action(self):
"""Make sure the create action and events happened"""
MF507ZDF8X:reddwarf mbasnigh$ sqlite3 reddwarf_test.sqlite
SQLite version 3.7.10 2012-01-16 13:28:40
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> select * from actions;
2013-05-28 19:06:21.950313|2013-05-28 19:06:41.267783|1|create_instance|a41d2edb-d5a6-4013-bbba-e81636f0ed60|req-75578aba-0e94-4db6-8c2d-0267dbeb99f5||No volume for you!
2013-05-28 19:06:22.631457|2013-05-28 19:06:22.631735|2|migrate_instance|a41d2edb-d5a6-4013-bbba-e81636f0ed60|req-08cd8572-bd33-4488-838f-5183a0f4bc81||
2013-05-28 19:06:22.916588|2013-05-28 19:06:22.916959|3|delete_instance|a41d2edb-d5a6-4013-bbba-e81636f0ed60|req-75578aba-0e94-4db6-8c2d-0267dbeb99f5||
2013-05-28 19:06:30.632819|2013-05-28 19:06:31.742129|4|resize_flavor_instance|a41d2edb-d5a6-4013-bbba-e81636f0ed60|req-08cd8572-bd33-4488-838f-5183a0f4bc81||Not found
2013-05-28 19:06:35.789000|2013-05-28 19:06:39.300215|5|resize_flavor_instance|a41d2edb-d5a6-4013-bbba-e81636f0ed60|req-75578aba-0e94-4db6-8c2d-0267dbeb99f5||Polling request
>>> fo(eventlet.greenthread.GreenThread)
[<eventlet.greenthread.GreenThread object at 0x38b7408>,
<eventlet.greenthread.GreenThread object at 0x38b75a0>]
>>> fo(eventlet.greenthread.GreenThread)[0].__dict__
{'_exit_event': <eventlet.event.Event object at 0x3b96650>,
'_exit_funcs': deque([(<bound method GreenPool._spawn_done of <eventlet.greenpool.GreenPool object at 0x388b690>>, (), {}), (<function _thread_done at 0x29c5578>, (), {'group': <reddwarf.openstack.common.threadgroup.ThreadGroup object at 0x38962d0>, 'thread': <reddwarf.openstack.common.threadgroup.Thread object at 0x37cc050>})]),
'_resolving_links': False}
>>>
expect -c "
spawn sudo -Hiu baz /usr/bin/ssh-keygen -f ~baz/id_rsa -q
expect \"empty for no passphrase\"
send \n
expect assphrase
send \n
expect eof"