diff options
author | Scott Moser <smoser@ubuntu.com> | 2016-06-03 15:31:38 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2016-06-03 15:31:38 -0400 |
commit | e513fc39555242f0be3049fb36eb04e708e70e66 (patch) | |
tree | 56b0059e822d0c0d2e0fc09ec24f664f75fb4ba4 /cloudinit/util.py | |
parent | 710590d3a32e6b77222b288e5b751e7296abb2b4 (diff) | |
parent | 80931f7008971c9a7705c054fabc29fec7a133e2 (diff) | |
download | vyos-cloud-init-e513fc39555242f0be3049fb36eb04e708e70e66.tar.gz vyos-cloud-init-e513fc39555242f0be3049fb36eb04e708e70e66.zip |
Apt sources configuration improvements
- keyid-only (no source statement)
- key only (no source statement)
- custom source.list template
- support long gpg key fingerprints with spaces
- fix issue with key's that were already in the local gpg keyring
- allowing a new format to specify apt_sources in a dictionary instead of a
list to allow merging of configurations
LP: #1574113
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r-- | cloudinit/util.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py index 8d6cbb4b..d6b80dbe 100644 --- a/cloudinit/util.py +++ b/cloudinit/util.py @@ -336,6 +336,16 @@ def rand_str(strlen=32, select_from=None): return "".join([random.choice(select_from) for _x in range(0, strlen)]) +def rand_dict_key(dictionary, postfix=None): + if not postfix: + postfix = "" + while True: + newkey = rand_str(strlen=8) + "_" + postfix + if newkey not in dictionary: + break + return newkey + + def read_conf(fname): try: return load_yaml(load_file(fname), default={}) |