configure_sources fails badly with misformatted configuration.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Charm Helpers |
Triaged
|
Undecided
|
Unassigned |
Bug Description
must use local copy of the ppa (opnecontrail or contrail) and won't
have access to the keyserver etc..
I nailed the issue as follow :
in add_source(source, key=None): in juju helpers python:
I try to pass a block with the gpg key starting with -----BEGIN PGP
PUBLIC KEY BLOCK----- and it fails on safe_loader ..
but if I do manually :
config-get install-keys | apt-key add -
it works ..
I might have badly formed it but could not figure out .. seems related to safe_loader
Backtrace :
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Traceback (most recent call last):
File "./hooks/install", line 406, in <module>
main()
File "./hooks/install", line 336, in main
hooks.
File "/var/lib/
line 672, in execute
self.
File "./hooks/install", line 314, in install
configure_
File "/var/lib/
line 339, in configure_sources
keys = safe_load(
File "/usr/lib/
in safe_load
return load(stream, SafeLoader)
File "/usr/lib/
return loader.
File "/usr/lib/
37, in get_single_data
node = self.get_
File "/usr/lib/
in get_single_node
document = self.compose_
File "/usr/lib/
in compose_document
self.
File "/usr/lib/
self.
File "/usr/lib/
parse_document_end
token = self.peek_token()
File "/usr/lib/
in peek_token
self.
File "/usr/lib/
in fetch_more_tokens
return self.fetch_value()
File "/usr/lib/
in fetch_value
self.
yaml.scanner.
in "<unicode string>", line 2, column 9:
Version\: GnuPG v1
^
Looks like safe_loader want to interpret it
Changed in charm-helpers: | |
status: | New → Invalid |
status: | Invalid → New |
status: | New → Incomplete |
status: | Incomplete → Opinion |
status: | Opinion → Invalid |
I think you missed a layer of quoting. The install_keys config item needs to be a YAML list of strings encoded as a string, and I don't think your list of strings was valid YAML.
The following syntax should work and the most readable I have found. The indentation and two levels of '|' quoting is vital.
install_keys: |
- |
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1
-----END PGP PUBLIC KEY BLOCK-----
- |
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1
-----END PGP PUBLIC KEY BLOCK-----