summaryrefslogtreecommitdiff
path: root/cloudinit/sources/DataSourceMAAS.py
AgeCommit message (Collapse)Author
2015-09-29MAAS: fix issues with url_helper and oauth moduleScott Moser
This would cause problems in the event that we actually had a bad clock. We add a retry in the main (for test) also, to ensure that the oauth timestamp fix gets in place. LP: #1499869
2015-08-25MAAS: fixes to data source and OauthUrlHelperScott Moser
the previous version was broken. The vital fixes here are: * adding parsedate and oauth1 imports to url_helper * fix skew_data usage intending to use self.skew_data Additionally: * reorder imports in url_helper * fixes to python3 -m cloudinit.sources.DataSourceMaas LP: #1488507
2015-08-07hopefully fix DataSourceMAASScott Moser
2015-08-06tests passScott Moser
2015-03-10DataSourceMAAS: fix timestamp error in oauthlibScott Moser
oddly enough, the timestamp you pass into oauthlib must be a None or a string. If not, raises ValueError: Only unicode objects are escapable. Got 1426021488 of type <class 'int'>
2015-03-10DataSourceMAAS: remove debug statementScott Moser
2015-03-05DataSourceMAAS: generate oauth headers with adjusted timestamp in case of ↵Oleg Strikov
clock skew This functionality has been introduced to fix LP: #978127, but was lost while migrating cloud-init to python3.
2015-03-02DataSourceMAAS: fix oauthlib importsScott Moser
In both python2 and python3, This throws "'module' object has no attribute 'oauth1'" $ python3 -c 'import oauthlib; oauthlib.oauth1.Client("x")' While this works fine: $ python3 -c 'import oauthlib.oauth1 as oauth1; oauth1.Client("x")'
2015-02-25move towards user-data being binaryScott Moser
UrlResponse: biggest change... make readurl return bytes, making user know what to do with it. util: add load_tfile_or_url for loading text file or url as read_file_or_url now returns bytes ec2_utils: all meta-data is text, remove non-obvious string translations DigitalOcean: adjust for ec2_utils DataSourceGCE, DataSourceMAAS: user-data is binary other fields are text. openstack.py: read paths without decoding to text. This is ok as paths other than user-data are json, and load_json will handle load_file still returns text, and that is what most things use.
2015-01-27Remove a comment turd.Barry Warsaw
2015-01-26Port the MAAS code to oauthlib.Barry Warsaw
2015-01-22Low hanging Python 3 fruit.Barry Warsaw
2015-01-21Largely merge lp:~harlowja/cloud-init/py2-3 albeit manually because it seemedBarry Warsaw
to be behind trunk. `tox -e py27` passes full test suite. Now to work on replacing mocker.
2013-04-25re-work maas datasource and headers call backsScott Moser
Couple of things here: * do not re-try on user-data (404 means 'not here') * re-generate headers on retry requests LP: #1172742
2013-03-19merge from trunk at revno 799Scott Moser
2013-03-06Continue working on merging code.Joshua Harlow
2013-02-23Fix the maas callback mechanism now that requests is used.harlowja
2013-02-23Get tests working and further adjustments.harlowja
2013-02-21Update to code on trunk.harlowja
2013-02-21More work on requests integration.harlowja
2013-02-19Continue working on integrating requests.harlowja
2012-10-23use only util methods for reading/loading/appending/peekingScott Moser
Use only util methods for reading/loading/appending/peeking at files since it is likely soon that we will add a new way of adjusting the root of files read, also it is useful for debugging to track what is being read/written in a central fashion.
2012-10-01fix oauth time skew. actual implementation was returning 401 not 403.Scott Moser
This fixes (tested) bug 978127. The server was actually returning a 401 not a 403. As such, the fix here was insufficient. This will now take either of those 2 error codes. I've also tested it by changing the clock in the cloud-init upstart job with a stanza like below, and verifying that we do see the problem and then it resolve itself: pre-start script offset="10 minutes ago" past=$(date -R --date "$offset") date --set "$past" && echo ===== "set date to $past [$offset]" ===== || echo ===== "failed to set date to $past [$offset]" ==== end script LP: #978127
2012-09-30[pylint]: remove unused importScott Moser
2012-09-28make DataSourceMAAS 'main()' use load_yamlScott Moser
2012-09-24DataSourceMAAS: if a oauth request fails due to 403 try updating local timeScott Moser
In the event of a 403 (Unauthorized) in oauth, try set a 'oauth_clockskew' variable. In future headers, use a time created by 'time.time() + self.oauth_clockskew'. The idea here is that if the local time is bad (or even if the server time is bad) we will essentially use something that should be similar to the remote clock. This fixes LP: #978127. LP: #978127
2012-09-20Use only util methods for reading/loading/appending/peekingJoshua Harlow
at files since it is likely soon that we will add a new way of adjusting the root of files read, also it is useful for debugging to track what is being read/written in a central fashion.
2012-08-06re-add the 'main' routine to DataSourceMAAS.pyScott Moser
the main function, which was usable for debugging maas was dropped during the rework branch. I'm adding it back here as it is very useful. It is possibly better implemented some other way than this, but this is good enough.
2012-06-21Ensure that calling the urls happens in a specified order.Joshua Harlow
2012-06-211. Move all info() logging methods to debug() harlowja
2. Adjust comment on sources list from depends 3. For the /etc/timezone 'writing', add a header that says created by cloud-init
2012-06-20Massive pylint + pep8 fixups!Joshua Harlow
2012-06-171. Add a url response class that urlreading now returns (instead of a tuple). harlowja
a. This allows for more properties to be added as needed in the future, instead of being very restrictive. 2. Fix up all uses of the url reading to now use this new response object. 3. Also fixup user data including, such that if no response actual occurs the url content is not further processed.
2012-06-16Some simple fixes that will make the python 3 translation easierJoshua Harlow
2012-06-15Fixups to ensure that pylint does not find anything major wrong.Joshua Harlow
2012-06-15Complete initial cleanup for refactoring/rework.Joshua Harlow
Some of the cleanups were the following 1. Using standard (logged) utility functions for sub process work, writing, reading files, and other file system/operating system options 2. Having distrobutions impelement there own subclasses to handle system specifics (if applicable) 3. Having a cloud wrapper that provides just the functionality we want to expose (cloud.py) 4. Using a path class instead of globals for all cloud init paths (it is configured via config) 5. Removal of as much shared global state as possible (there should be none, minus a set of constants) 6. Other various cleanups that remove transforms/handlers/modules from reading/writing/chmoding there own files. a. They should be using util functions to take advantage of the logging that is now enabled in those util functions (very useful for debugging) 7. Urls being read and checked from a single module that serves this and only this purpose (+1 for code organization) 8. Updates to log whenever a transform decides not to run 9. Ensure whenever a exception is thrown (and possibly captured) that the util.logexc function is called a. For debugging, tracing this is important to not just drop them on the floor. 10. Code shuffling into utils.py where it makes sense (and where it could serve a benefit for other code now or in the future)
2012-06-07Darn it. Those shouldn't be there!Joshua Harlow