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

Unable to upload .tar file as local resource to deployed charmed application #1000

Open
NucciTheBoss opened this issue Jan 3, 2024 · 4 comments · May be fixed by #1147
Open

Unable to upload .tar file as local resource to deployed charmed application #1000

NucciTheBoss opened this issue Jan 3, 2024 · 4 comments · May be fixed by #1147
Labels
kind/wishlist requested feature

Comments

@NucciTheBoss
Copy link

The problem

When trying to run the integration tests for the slurmd charmed operator, our CI pipeline fails with the following stacktrace:

Traceback (most recent call last):
  File "/home/runner/work/slurmd-operator/slurmd-operator/tests/integration/test_charm.py", line 48, in test_build_and_deploy
    await asyncio.gather(
  File "/home/runner/work/slurmd-operator/slurmd-operator/.tox/integration/lib/python3.10/site-packages/juju/model.py", line 1820, in deploy
    resources = await self.add_local_resources(application_name,
  File "/home/runner/work/slurmd-operator/slurmd-operator/.tox/integration/lib/python3.10/site-packages/juju/model.py", line 2052, in add_local_resources
    data = p.read_text() if p.exists() else ''
  File "/usr/lib/python3.10/pathlib.py", line 1135, in read_text
    return f.read()
  File "/usr/lib/python3.10/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte

This error is raised when we try to attach our resource lbnl-nhc-1.4.3.tar.gz to the slurmd application. NHC (Node Health Check) is a utility for measuring the health of compute nodes in your cluster; it is commonly used to collect observability metrics. When we try to attach NHC, pathlib.Path(...).read_text(...) tries to decode the .tar.gz file as an utf-8 text file rather than a binary file. This causes python-libjuju to raise the above UnicodeDecodeError which then torpedoes our CI pipeline. The block of code below is what is responsible for this issue:

python-libjuju/juju/model.py

Lines 2050 to 2052 in 2581b0c

else:
p = Path(path)
data = p.read_text() if p.exists() else ''

This could potentially be fixed by switch the implementation to pathlib.Path(...).read_bytes(...)

Steps to reproduce

  1. Assume that you already have a cloud and Juju controller set up...
  2. git clone -b jaime/drop-focal-support [email protected]:jaimesouza/slurmd-operator.git
  3. cd slurmd-operator
  4. tox run -e integration
  5. Wait a few minutes...
  6. See stacktrace with UnicodeDecodeError
Copy link

github-actions bot commented Feb 3, 2024

This issue is marked as incomplete because it has been open 30 days with no activity. Please remove incomplete label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the state/incomplete need more information label Feb 3, 2024
@cderici cderici added kind/wishlist requested feature and removed state/incomplete need more information labels Feb 5, 2024
Copy link

This issue is marked as incomplete because it has been open 30 days with no activity. Please remove incomplete label or comment or this will be closed in 5 days.

Copy link

This issue was closed because it has been stalled for 5 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 17, 2024
@hmlanigan
Copy link
Member

Closed prematurely by the bot.

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

Successfully merging a pull request may close this issue.

3 participants