Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test-app issue due to binary Hashicorp GPG key #68

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

benhoyt
Copy link
Collaborator

@benhoyt benhoyt commented Jan 23, 2023

Not sure how this ever worked -- maybe the Hashicorp URL used to return an ASCII key? Now it definitely returns binary, so use the gpg command to convert it to ASCII format.

___________________ test_install_package_external_repository ___________________
Traceback (most recent call last):
  File "/ops-libs-test/tests/integration/test_apt.py", line 45, in test_install_package_external_repository
    key = urlopen("https://apt.releases.hashicorp.com/gpg").read().decode()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x99 in position 0: invalid start byte

Not sure how this ever worked -- maybe the Hashicorp URL used to return
an ASCII key? Now it definitely returns binary, so use the gpg command
to convert it to ASCII format.
@benhoyt
Copy link
Collaborator Author

benhoyt commented Jan 23, 2023

Hmmm, integration tests still failed. Seems like there's more to do here. For another day:

___________________ test_install_package_external_repository ___________________
Traceback (most recent call last):
  File "/ops-libs-test/tests/integration/test_apt.py", line 61, in test_install_package_external_repository
    repo.import_key(key)
  File "/ops-libs-test/lib/charms/operator_libs_linux/v0/apt.py", line 1056, in import_key
    self._write_apt_gpg_keyfile(key_name=key, key_material=key_gpg)
  File "/ops-libs-test/lib/charms/operator_libs_linux/v0/apt.py", line 1152, in _write_apt_gpg_keyfile
    with open(key_name, "wb") as keyf:
FileNotFoundError: [Errno 2] No such file or directory: ''
------------------------------ Captured log call -------------------------------
INFO     charms.operator_libs_linux.v0.apt:apt.py:1230 parsed 22 apt package repositories
WARNING  charms.operator_libs_linux.v0.apt:apt.py:1042 PGP key found (looks like Radix64 format). SECURELY importing PGP key from keyserver; full key not provided.
________________ test_list_file_generation_external_repository _________________
Traceback (most recent call last):
  File "/ops-libs-test/tests/integration/test_apt.py", line 85, in test_list_file_generation_external_repository
    apt.update()
  File "/ops-libs-test/lib/charms/operator_libs_linux/v0/apt.py", line 841, in update
    check_call(["apt-get", "update"], stderr=PIPE, stdout=PIPE)
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['apt-get', 'update']' returned non-zero exit status 100.
------------------------------ Captured log call -------------------------------
INFO     charms.operator_libs_linux.v0.apt:apt.py:1230 parsed 22 apt package repositories
INFO     charms.operator_libs_linux.v0.apt:apt.py:1230 parsed 1 apt package repositories

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant