-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests get imageRef from nova #1835
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,6 +141,36 @@ def list_servers(rcs, pool, _treq=treq): | |
).addCallback(check_success, [200]).addCallback(_treq.json_content) | ||
|
||
|
||
@diagnose("nova", "Listing all images") | ||
def list_images(rcs, pool, _treq=treq): | ||
""" | ||
Get a list of all images. | ||
""" | ||
params = {'limit': 10000} | ||
return _treq.get( | ||
"{}/images".format(rcs.endpoints['nova']), | ||
params=params, | ||
headers=headers(str(rcs.token)), | ||
pool=pool | ||
).addCallback(check_success, [200]).addCallback(_treq.json_content) | ||
|
||
|
||
@inlineCallbacks | ||
def fetch_ubuntu_image_id(rcs, pool): | ||
""" | ||
Get image ID from nova that can be used in creating servers or | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Including a cross-reference link to the cloudcafe version, since these are really the same function, would be handy. Might it be a good idea to make the signature the same, and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cross-referencing is a great idea. Will do, however I am not sure if this function needs to return non-Ubuntu image as it is not used in tests anywhere. |
||
scaling group | ||
Note: Serves the same purpose as fixtures.image_ids_with_and_without_name | ||
in cloudcafe tests | ||
""" | ||
images_resp = yield list_images(rcs, pool) | ||
for image in images_resp["images"]: | ||
if image["name"].startswith("Ubuntu"): | ||
returnValue(image["id"]) | ||
else: | ||
returnValue(images_resp["images"][0]["id"]) | ||
|
||
|
||
@diagnose("nova", "Creating server") | ||
def create_server(rcs, pool, server_args, _treq=treq): | ||
""" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
git+https://github.com/rackerlabs/mimic.git@b4ffe4b066430404f5363d7506a6228fcc2d5b4f |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mutable staaaaate :-(
I do like the fact that this makes the data structure more regular-python-ish and less of a wrapper around a weird dictionary. But I don't like the fact that this change results in even less documentation for these two properties. It took me a minute to understand what they were supposed to be, and why this was in a "config section" at all. Can you add some
:ivar:
documentation to the class docstring?Also, these are default-NULL, which I am coming to believe is always an antipattern. I wrote some about this in Python: https://glyph.twistedmatrix.com/2015/09/python-option-types.html and of course there's the option of
sumtypes
. When and why are these valuesNone
?