summaryrefslogtreecommitdiff
path: root/cloudinit/util.py
AgeCommit message (Collapse)Author
2015-03-02get_cmdline_url: fix in python3 when callingScott Moser
get_cmdline_url was passing a string to response.contents.startswith() where response.contents is now bytes. this changes it to convert input to text, and also to default to text.
2015-03-02util.py: remove 'print' debug statementScott Moser
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-02-12mount_cb: fix scoping of an exception in python3Scott Moser
2015-02-11include exception in error again.Scott Moser
it is admittedly not clear, but 'exc' should be definied if mountpoint is not.
2015-02-11Open /dev/console in text mode (so we don't have to encode strings to write ↵Daniel Watkins
them).
2015-02-11Fix reference to non-existent variable.Daniel Watkins
2015-02-10pep8Scott Moser
2015-02-11fix random_seed moduleScott Moser
2015-01-27Respond to review:Barry Warsaw
- Refactor "fully" decoding the payload of a text/* part. In Python 3, decode=True only means to decode according to Content-Transfer-Encoding, not according to any charset in the Content-Type header. So do that.
2015-01-27Respond to review:Barry Warsaw
- Refactor both the base64 encoding and decoding into utility functions. Also: - Mechanically fix some other broken untested code.
2015-01-26Repair the Python 2.6 tests.Barry Warsaw
2015-01-26Trunk merged and ported.Barry Warsaw
2015-01-26Avoid a nose bug when running under the test suite and no exception is inBarry Warsaw
flight.
2015-01-23* Fix the filter() imports.Barry Warsaw
* In Py3, pass universal_newlines to subprocess.Popen()
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.
2015-01-21Use either syspath or dmidecode based on the availability.Ben Howard
2015-01-21Fix file modes to be Python 2/3 compatible.Barry Warsaw
2015-01-14Drop reliance on dmidecode executable.Ben Howard
2015-01-06tools/run-pep8: remove leading ',' fed to --ignoreScott Moser
--ignore was being called with ',E121,E...' rather than 'E121,E...'. that resulted in odd behavior, missing the pep8 errors that are fixed here.
2014-11-21Pretty up the debug moduleJoshua Harlow
Previously the usage of the yaml_dumps module was causing any python unicode key and value to show up as: 'item': !!python/unicode "some string" This was not very pretty... Fix this by using safe_dumps (which is also a good thing to use and allow_unicode=True). Also create a tiny helper function in the cc_debug module that does not include the yaml start and end footers (since this module has its own footers and headers). Also includes a basic sanity test for this module.
2014-11-21Increase the robustness/configurability of the chef module...Joshua Harlow
Add the following adjustments to the chef template and module: - Make it so that the chef directories can be provided (defaults to the existing directories) - Make the params much more configurable, and if a parameter is provided in the chef configuration it will override existing template parameters. - Make the template skip lines if the values are None in the configuration so that template lines can be removed if/when this is desirable. - Allow the firstboot json path to be configurable (defaults to the existing location). - Adds a basic set of tests to ensure that good things are happening. - Make a helper function to tell if already installed. - Have the install routine not run chef after installed but have it instead return a result to tell the caller to run the chef program once completed. - Use the generated_by() utility function to give the ruby template a better header comment. - Set special parameters after selecting the basic chef parameters. - Allow for the running after install and run arguments to be configured. - Allow the omnibus url fetching retries to be configurable. - Move the chef running to its own helper function - Add module docs
2014-10-29fix bad logic resulting in failure to honor 'output' config.Scott Moser
This busted logic causes 'output' to not be paid any attention to, and thus output is not written to /var/log/cloud-init-output.log. LP: #1387340
2014-10-18Pretty up the debug moduleJoshua Harlow
Previously the usage of the yaml_dumps module was causing any python unicode key and value to show up as: 'item': !!python/unicode "some string" This was not very pretty... Fix this by using safe_dumps (which is also a good thing to use and allow_unicode=True). Also create a tiny helper function in the cc_debug module that does not include the yaml start and end footers (since this module has its own footers and headers). Also includes a basic sanity test for this module.
2014-10-11Allow the omnibus url fetching retries to be configurableJoshua Harlow
2014-10-10Fix newline added at end of fileJoshua Harlow
2014-10-10Undo changes to the util file, not sure why that happened...Joshua Harlow
2014-10-10Increase the robustness of the chef moduleJoshua Harlow
Add the following adjustments to the chef template and module - Make it so that the chef directories can be provided (defaults to the existing directories) - Make the params much more configurable, and if a parameter is provided in the chef configuration it will override existing template parameters. - Make the template skip lines if the values are None in the configuration so that template lines can be removed if/when this is desirable. - Allow the firstboot json path to be configurable (defaults to the existing location). - Adds a basic set of tests to ensure that good things are happening.
2014-09-30support human2bytes, separate handling out to methodScott Moser
2014-09-30add code for setting up swap fileScott Moser
2014-09-29further platform cleanupScott Moser
2014-09-29fix re-use of 'platform' in local scopeScott Moser
2014-09-22support 'mtype' as a list, and fix up freebsd mount typesScott Moser
this supports a list of input, and cleans up that list for the platform specific mount types. Basically, mtype = None means 'mount -t auto' or the equivalent for the platform. and 'iso9660' means "iso type".
2014-09-22merge from trunkScott Moser
2014-09-15merge from trunkScott Moser
2014-09-15Remove pylint: linesJay Faulkner
2014-09-15Fix bug 1338614Jay Faulkner
util.log_time()'s return value was what was being sent to fork_cb. This means the resize ran in parallel and the call to fork_cb threw a traceback (trying to call Nonetype). By permitting fork_cb to take kwargs, and using the correct method syntax, this now forks and resizes in the background as appropriate.
2014-08-26further remove evidence of pylint.Scott Moser
This just removes comments '# pylint:' things and other code remnents of pylint.
2014-08-26fix(pep8): Fix various pep8 violations and version-lock pep8Jay Faulkner
Fixed all complaints from running "make pep8". Also version locked pep8 in test-requirements.txt to ensure that pep8 requirements don't change without an explicit commit.
2014-08-23Removed using lazy mode for umountJoseph Bajin
Safer for cloud-init to not use lazy mode for unmount
2014-08-18fix: Updated some syntax to be pep8 compliantJoseph Bajin
2014-08-18new: Added FreeBSD support to ConfigDriveJoseph Bajin
2014-07-24SeLinuxGuard: remove invalid check for sanity around restorecon, fix testScott Moser
previous commit occurred because the selinux test was failing in a schroot where there was no /etc/hosts. Now, fix that test more correctly, and fix some bad assumptions in the SeLinuxGuard.
2014-02-24fixes from testing, force symlinkScott Moser
2014-02-07Remerged with trunkJoshua Harlow
2014-02-01Add a openstack specific datasourceJoshua Harlow
Openstack has a unique derivative datasource that is gaining usage. Previously the config drive datasource provided part of this functionality as well as the ec2 datasource, but since new functionality is being added to openstack is seems benefical to combine the used parts into one datasource just made for handling openstack deployments. This patch factors out the common logic shared between the config drive and the openstack metadata datasource and places that in a shared helper file and then creates a new openstack datasource that readers from the openstack metadata service and refactors the config drive datasource to use this common logic.
2014-01-29merge from trunkScott Moser
2014-01-28cloudinit/util.py: fix pylint complaintsScott Moser
2014-01-28Allow zeros when detecting IPv4 address (e.g. 192.168.0.1)Vlastimil Holer