Merge lp:~alexandru-sirbu/cloud-init/bigstep-datasource-improvements into lp:~cloud-init-dev/cloud-init/trunk
| Status: | Merged |
|---|---|
| Merged at revision: | 1177 |
| Proposed branch: | lp:~alexandru-sirbu/cloud-init/bigstep-datasource-improvements |
| Merge into: | lp:~cloud-init-dev/cloud-init/trunk |
| Diff against target: |
49 lines (+13/-1) 2 files modified
cloudinit/settings.py (+1/-0) cloudinit/sources/DataSourceBigstep.py (+12/-1) |
| To merge this branch: | bzr merge lp:~alexandru-sirbu/cloud-init/bigstep-datasource-improvements |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Dan Watkins | 2016-03-07 | Approve on 2016-03-08 | |
| Scott Moser | 2016-03-08 | Pending | |
|
Review via email:
|
|||
Description of the Change
Based on the proposal of smoser:
<smoser> Odd_Bloke, when you dont have that file there..
<smoser> i dontrecall. does cloud-init warn that the ds raised exception ?
<smoser> can you just try and catch the load_file and return false if not there ?
+ Added Bigstep as one of the default datasources in the settings.py file
| Alex Sirbu (alexandru-sirbu) wrote : | # |
| Dan Watkins (daniel-thewatkins) wrote : | # |
On 07/03/16 12:18, Alex Sirbu wrote:
>> === modified file 'cloudinit/
>> --- cloudinit/
>> +++ cloudinit/
>> @@ -22,7 +23,13 @@
>> self.userdata_raw = ""
>>
>> def get_data(self, apply_filter=
>> - url = get_url_from_file()
>> + try:
>
> So, have the try catch there and return a NULL value or something similar and then return False if the url returned by the function has that value?
Yeah, I think that makes sense.
>> + url = get_url_from_file()
>> + except IOError as e:
>> + if e.errno == errno.ENOENT:
>
> Exactly, if the file does not exist (the case covered by the ENOENT) then it is ok, as we probably are on a non-Bigstep server. However, if another error is raised, then it is probably worthwhile to see and investigate the issue and is probably not caused by the inexistance of the file. The same error catching is also used in the load_config function in the read_conf from the util file -> the inexistance of the file is treated as an empty config, any other error is thrown anyway. Does an explanation need to be added in this case?
It's not immediately obvious to me, so I would still like one. Just
something like "If the file doesn't exist, this isn't Bigstep;
otherwise, this is broken Bigstep".
- 1179. By Alex Sirbu on 2016-03-07
-
Implemented review concerning position of try and more information about the caught exception.
| Dan Watkins (daniel-thewatkins) wrote : | # |
Thanks Alex, this looks good to me; I've added smoser to confirm that this addresses his concern.


Commented on reviews.