-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fa2049f caused an import cycle between lock.py and misc.py. Move the needed functions from lock.py to lockstatus.py so that we can avoid the import cycle. Signed-off-by: Sam Lang <[email protected]> Conflicts: teuthology/lock.py
- Loading branch information
Showing
4 changed files
with
36 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import json | ||
import httplib2 | ||
import logging | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
def _lock_url(ctx): | ||
return ctx.teuthology_config['lock_server'] | ||
|
||
def send_request(method, url, body=None, headers=None): | ||
http = httplib2.Http() | ||
resp, content = http.request(url, method=method, body=body, headers=headers) | ||
if resp.status == 200: | ||
return (True, content, resp.status) | ||
log.info("%s request to '%s' with body '%s' failed with response code %d", | ||
method, url, body, resp.status) | ||
return (False, None, resp.status) | ||
|
||
def get_status(ctx, name): | ||
success, content, _ = send_request('GET', _lock_url(ctx) + '/' + name) | ||
if success: | ||
return json.loads(content) | ||
return None | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters