Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Miscellaneous cleanups to execute_command.
- Add `.cache/` to `.gitignore` for pytest.
- Remove logging dependency.
- Simplify conditional.
  • Loading branch information
tkaemming committed Feb 3, 2016
1 parent f518eca commit 3fe0609
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -2,6 +2,7 @@ docs/_build
*.pyc
*.pyo
.DS_Store
.cache/
build
dist
*.egg-info
14 changes: 8 additions & 6 deletions rb/cluster.py
Expand Up @@ -6,17 +6,13 @@
SSLConnection = None

import functools
import logging
from hashlib import sha1
from threading import Lock

from rb.router import PartitionRouter
from rb.clients import RoutingClient, LocalClient


logger = logging.getLogger(__name__)


class HostInfo(object):

def __init__(self, host_id, host, port, unix_socket_path=None, db=0,
Expand Down Expand Up @@ -340,7 +336,13 @@ def is_script_command(command):

def check_script_load_result(script, result):
if script.sha != result:
logger.warning('Hash mismatch loading %r: expected %r, got %r!', script, script.sha, result)
raise AssertionError(
'Hash mismatch loading {!r}: expected {!r}, got {!r}'.format(
script,
script.sha,
result,
)
)

# Run through all the commands and check to see if there are any
# scripts, and whether or not they have been loaded onto the target
Expand Down Expand Up @@ -377,7 +379,7 @@ def check_script_load_result(script, result):
for host in targeted._target_hosts:
if script in exists[host]:
result = exists[host].pop(script)
if bool(result.value[0]) == False:
if not result.value[0]:
targeted.execute_command('SCRIPT LOAD', script.script).done(
on_success=functools.partial(check_script_load_result, script)
)
Expand Down

0 comments on commit 3fe0609

Please sign in to comment.