Closed mtaylor closed 11 years ago
Hmm, while tests do pass for me locally, I notice travis failed, and when I try the above steps, I get a 400 from factory, full factory output is:
2012-12-12 16:36:32,764 DEBUG paste.httpserver.ThreadPool thread(MainThread) Message: Added task (0 tasks queued)
2012-12-12 16:36:32,766 DEBUG imgfac.rest.RESTtools thread(worker 0) Message: Handling application/json HTTP POST REQUEST for resource at /imagefactory/provider_images: {"provider_image":{"credentials":"","parameters":{"callbacks":["http://localhost:3000/tim/provider_images//1"],"snapshot":true},"provider":"MockSphere","target":"MockSphere","template":"<template><name>mock</name><os><name>RHELMock</name><version>1</version><arch>x86_64</arch><install type=\"iso\"><iso>http://mockhost/RHELMock1-x86_64-DVD.iso</iso></install><rootpw>password</rootpw></os><description>Mock Template</description></template>"}}
2012-12-12 16:36:32,766 ERROR imgfac.rest.RESTv2 thread(worker 0) Message: HTTP Response 400
Traceback (most recent call last):
File "/home/jay/projects/aeolus/imagefactory/imgfac/rest/RESTv2.py", line 135, in create_image
raise HTTPResponse(status=400, output="Missing key/value pair: provider(%s), credentials(%s), target(%s)" % (_provider, _credentials, _target))
HTTPResponse: HTTP Response 400
It looks to me like everything is there that should be, so perhaps something is not right in my factory config, I'll tinker with it tomorrow if you think this may be the case.
Ok, as discussed in irc, with the minor change to the example, this now works for me, though it sounds like there may be an issue with how factory is returning the image identifier, as that does not get set in tim, even though an id is passed with the callback. I don't know if that is a fix needed in tim or factory, but I am putting the return values from factory so we can decide how to proceed (and whether it belongs in this patch or, more likely, a follow up one):
2012-12-13 10:25:34,121 DEBUG imgfac.CallbackWorker.CallbackWorker thread(Thread-2) Message: PUTing update to URL (http://localhost:3000/tim/provider_images//2)
2012-12-13 10:25:34,122 DEBUG imgfac.FilePersistentImageManager.FilePersistentImageManager thread(1a31c1f2) Message: Saved metadata for image (b1d417ba-18e3-4df2-ab93-edae60d1a4e9): {'status': 'COMPLETE', 'identifier': 'b1d417ba-18e3-4df2-ab93-edae60d1a4e9', 'parameters': None, 'icicle': None, 'data': '/media/fantom/imagefactory/storage/b1d417ba-18e3-4df2-ab93-edae60d1a4e9.body', 'identifier_on_provider': None, 'status_detail': {'error': None, 'activity': 'Initializing image prior to Cloud/OS customization'}, 'provider_account_identifier': None, 'template': '<template><name>mock</name><os><name>RHELMock</name><version>1</version><arch>x86_64</arch><install type="iso"><iso>http://mockhost/RHELMock1-x86_64-DVD.iso</iso></install><rootpw>password</rootpw></os><description>Mock Template</description></template>', 'provider': 'MockSphere', 'target_image_id': None, 'percent_complete': 0, 'type': 'ProviderImage'}
In case this makes it easier, on the tim side, this is how it was received:
Started PUT "/tim/provider_images//2" for 127.0.0.1 at 2012-12-13 10:25:34 -0500 [78/89]
Processing by Tim::ProviderImagesController#update as HTML
Parameters: {"provider_image"=>{"status"=>"COMPLETE", "_type"=>"ProviderImage", "param
eters"=>nil, "identifier_on_provider"=>nil, "icicle"=>nil, "status_detail"=>{"error"=>ni
l, "activity"=>"Initializing image prior to Cloud/OS customization"}, "provider_account_
identifier"=>nil, "template"=>"<template><name>mock</name><os><name>RHELMock</name><vers
ion>1</version><arch>x86_64</arch><install type=\"iso\"><iso>http://mockhost/RHELMock1-x
86_64-DVD.iso</iso></install><rootpw>password</rootpw></os><description>Mock Template</d
escription></template>", "provider"=>"MockSphere", "percent_complete"=>0, "id"=>"b1d417b
a-18e3-4df2-ab93-edae60d1a4e9"}, "id"=>"2"}
Ok, this is clearly not a problem with the pull request, MockSphere just doesnt set this.
You can test this manually in the console using the commands below. Be sure to have imagefactory running:
== Commands