summaryrefslogtreecommitdiff
path: root/cloudinit/config/cc_apt_configure.py
AgeCommit message (Collapse)Author
2020-11-25cc_apt_configure: add riscv64 as a ports arch (#687)Dimitri John Ledkov
2020-06-08Move subp into its own module. (#416)Scott Moser
This was painful, but it finishes a TODO from cloudinit/subp.py. It moves the following from util to subp: ProcessExecutionError subp which target_path I moved subp_blob_in_tempfile into cc_chef, which is its only caller. That saved us from having to deal with it using write_file and temp_utils from subp (which does not import any cloudinit things now). It is arguable that 'target_path' could be moved to a 'path_utils' or something, but in order to use it from subp and also from utils, we had to get it out of utils.
2020-06-02test: fix all flake8 E241 (#403)Joshua Powers
Remove extra spaces after a ','
2020-05-13Add schema to apt configure config (#357)lucasmoura
Create a schema object for the `apt_configure` module and validate this schema in the `handle` function of the module. There are some considerations regarding this PR: * The `primary` and `security` keys have the exact same properties. I tried to eliminate this redundancy by moving their properties to a common place and then just referencing it for both security and primary. Similar to what is documented here: https://json-schema.org/understanding-json-schema/structuring.html under the `Reuse` paragraph. However, this approach does not work, because the `#` pointer goes to the beginning of the file, which is a python module instead of a json file, not allowing the pointer to find the correct definition. What I did was to create a separate dict for the mirror config and reuse it for primary and security, but maybe there are better approaches to do that. * There was no documentation for the config `debconf_selections`. I tried to infer what it supposed to do by looking at the code and the `debconf-set-selections` manpage, but my description may not be accurate or complete. * Add a _parse_description function to schema.py to render multi-line preformatted content instead of squashing all whitespace LP: #1858884
2020-03-23cc_apt_configure/util: combine search_for_mirror implementations (#271)Daniel Watkins
These two implementations had drifted away from one another very slightly. Reconcile them and then remove the one in cc_apt_configure.
2020-01-16util: rename get_architecture to get_dpkg_architecture (#173)Daniel Watkins
This makes it clearer that we should only use this in code paths that will definitely have dpkg available to them. - Rename get_architecture -> get_dpkg_architecture - Add docstring to get_dpkg_architecture
2020-01-16Ensure util.get_architecture() runs only once (#172)Ryan Harper
* Ensure util.get_architecture() runs only once util.get_architecture() recently was wrapped using python3's lru_cache() which will cache the result so we only invoke 'dpkg --print-architecture' once. In practice, cloud-init.log will show multiple invocations of the command. The source of this was that the debian Distro object implements the get_primary_arch() with this command, but it was not calling it from util, but issuing a util.subp() directly. This branch also updates cc_apt_configure methods to fetch the arch value from the distro class, and then ensure that the methods apt_configure calls pass the arch value around. * utils: remove lsb_release and get_architecture wrappers The original lsb_release wrapper was used to prevent polluting the single value we cached, however lru_cache() already handles this case by using args, kwargs values to cache different calls to the method. * rename_apt_list: use all positional parameters
2019-08-19ubuntu-drivers: emit latelink=true debconf to accept nvidia eulaChad Smith
To accept NVIDIA EULA, cloud-init needs to emit latelink=true debconf setting to the linux-restricted-modules package to allow NVIDIA drivers to properly link to the running kernel. LP: #1840080
2019-04-17cc_apt_configure: fix typo in apt documentationDominic Schlegel
2018-04-19pylint: pay attention to unused variable warnings.Scott Moser
This enables warnings produced by pylint for unused variables (W0612), and fixes the existing errors.
2018-04-18pycodestyle: Fix invalid escape sequences in string literals.Scott Moser
Python has deprecated these invalid string literals now https://bugs.python.org/issue27364 and pycodestyle is identifying them with a W605 warning. https://github.com/PyCQA/pycodestyle/pull/676 So basically, any use of \ not followed by one of [\'"abfnrtv] or \ooo (octal) \xhh (hex) or a newline is invalid. This is most comomnly seen for us in regex. To solve, you either: a.) use a raw string r'...' b.) correctly escape the \ that was not intended to be interpreted.
2017-12-15lint: Fix lints seen by pylint version 1.8.1.Chad Smith
This branch resolves lints seen by pylint revision 1.8.1 and updates our pinned tox pylint dependency used by our tox pylint target.
2017-05-16unittests: fix unittests run on centosJoshua Powers
Apt related tests were broken when running on centos becasue apt is not available. This fixes the unit test, with a small re-work of apt_configure. Also in 'tox -e centos6' only run nose on tests/unittests as tests/ also contain integration tests that should not be run.
2017-04-29Fix name of "uri" key in docs for "cc_apt_configure" moduleFelix Dreissig
The key is called "uri", not "url". This is what's used throughout the examples and also what works in practice (verified on Ubuntu 16.10). This also slightly improves formatting of the key names in the related documentation.
2017-04-21pylint: fix all logging warningsJoshua Powers
This will change all instances of LOG.warn to LOG.warning as warn is now a deprecated method. It will also make sure any logging uses lazy logging by passing string format arguments as function parameters.
2017-03-29apt_configure: run only when needed.Scott Moser
Do not bother configuring apt if no 'apt' config is provided and either: a.) running on snappy b.) there is no 'apt' command (possibly a different distro) If apt config is provided in either of the above situations, then config will continue. LP: #1675185
2016-12-22LICENSE: Allow dual licensing GPL-3 or Apache 2.0Jon Grimm
This has been a recurring ask and we had initially just made the change to the cloud-init 2.0 codebase. As the current thinking is we'll just continue to enhance the current codebase, its desirable to relicense to match what we'd intended as part of the 2.0 plan here. - put a brief description of license in LICENSE file - put full license versions in LICENSE-GPLv3 and LICENSE-Apache2.0 - simplify the per-file header to reference LICENSE - tox: ignore H102 (Apache License Header check) Add license header to files that ship. Reformat headers, make sure everything has vi: at end of file. Non-shipping files do not need the copyright header, but at the moment tests/ have it.
2016-11-22Doc: various documentation fixesSean Bright
Several various minor fixes for the readthedocs documentation.
2016-09-30Improve module documentation and doc cleanup.Wesley Wiedenmeier
This adds lots of config module documentation in a standard format. It will greatly improve the content at readthedocs. Additionally: * Add a 'doc' env to tox.ini * Changed default highlight language for sphinx conf from python to yaml most examples in documentation are yaml configs * Updated datasource examples to highlight sh code properly
2016-09-08apt config conversion: treat empty string as not provided.Scott Moser
Old behavior allowed a user to provide: apt_mirror: "" And that was the same as: apt_mirror: null and the same as having not specified apt_mirror at all. This maintains that behavior for all old string values. LP: #1621180
2016-08-26apt-config: allow both old and new format to be present.Christian Ehrhardt
This allows both v1/2 and and v3 formats to exist in config. If both are present, then prefer v3. If values are not the same then a ValueError is raised. LP: #1616831
2016-08-18Apt: add new apt configuration formatChristian Ehrhardt
This adds an improved apt configuration format that is fully backwards compatible with previous behavior. This is mostly copied from curtin's implementation. It does: * clean up and centralizes many of the top level 'apt_*' values that previously existed into a single top level 'apt'key. * support a 'source' in apt/sources/entry that has only a key * documents new features and adds tests. See the added doc/examples/cloud-config-apt.txt for more information.
2016-06-15fix some errors reported by pylintScott Moser
pylint --errors-only found several errors. Some of the changes here represent real errors, others just code that pylint did not like.
2016-06-10minor changes prior to mergeScott Moser
a.) remove 'gpg_' from function names in new gpg module. b.) use --recv-keys rather than --recv --recv-keys is more obvious and works back to precise at least. c.) do not trim trailing '\n' from a armour'd key.
2016-06-09move gpg functions into gpg.pyChristian Ehrhardt
This helps for cleaner code structuring. ALong that makeing sure all these functions have a gpg_prefix.
2016-06-06rename fucntion to mirrorurl_to_apt_fileprefix to reflect what it actually doesChristian Ehrhardt
2016-06-06rename add_key / add_source to add_apt_key / add_apt_sourceChristian Ehrhardt
The functions clearly are apt specific so the name should reflect that.
2016-06-06add_key_raw - make exceptions more specificChristian Ehrhardt
2016-06-06pythonify getkeybyid and move it to uitl.pyChristian Ehrhardt
2016-06-03fix tox -e flake8Scott Moser
2016-05-30fix EXPORT_GPG_KEYID for existing keysChristian Ehrhardt
This was broken for keys already existing in the local keyring. There instead of the keycontent it reported the header like: pub 1024R/03683F77 2009-10-27 uid Launchpad PPA for Scott Moser
2016-05-30drop errorlist from convert_to_new_formatChristian Ehrhardt
2016-05-24pacify pep8 regarding the new changesChristian Ehrhardt
2016-05-24integrate further smaller review feedbackChristian Ehrhardt
2016-05-24rebased with upstream and reolved merge conflictsChristian Ehrhardt
2016-05-23make sure we only handle list or dict apt_sources and bail out for othersChristian Ehrhardt
2016-05-23fix issue with dictionary style apt_sources handling filenamesChristian Ehrhardt
2016-05-23warn about multiple colliding apt_source without filenamesChristian Ehrhardt
2016-05-23support apt_sources to be a dictionaryChristian Ehrhardt
key is the filename, and "old" input shall be handled as it was all the time. For compatibility this will (continue to) overwrite the file of multiple options that did not specify an output file (they all get the same default). Yet it will process them all - as it always did - e.g. to add the keys of all of them. Any users of the new format won't have these issues, as they will always have a key.
2016-05-12make pep8 happy with a few spacesChristian Ehrhardt
2016-05-12split add_key and add_key_raw fior better testabilityChristian Ehrhardt
2016-05-12fix EXPORT_GPG_KEYID for long key fingerprintsChristian Ehrhardt
2016-05-12Fix up a ton of flake8 issuesJoshua Harlow
2016-05-12remove Unnecessary parens in add_keyChristian Ehrhardt
2016-05-12move errorlist.append out of add_keyChristian Ehrhardt
2016-05-12add feature to allow a custom template for source listChristian Ehrhardt
2016-05-12remove missed test printChristian Ehrhardt
2016-05-12test mirror list with failing mirrorChristian Ehrhardt
2016-05-12allow to add keys without specifying a sourceChristian Ehrhardt
2016-03-03Update pep8 runner and fix pep8 issuesRyan Harper