OCI Image Resource helper
This is a helper for working with OCI image resources in the charm operator framework.
Usage
Add this to your charm by including oci-image in your requirements.txt file.
The OCIImageResource class will wrap the framework resource for the given
resource name, and calling fetch on it will either return the image info
or raise an OCIImageResourceError if it can't fetch or parse the image
info. The exception will have a status attribute you can use directly,
or a status_message attribute if you just want that.
Example usage:
from ops.charm import CharmBase
from ops.main import main
from oci_image import OCIImageResource, OCIImageResourceError
class MyCharm(CharmBase):
def __init__(self, *args):
super().__init__(*args)
self.image = OCIImageResource(self, 'resource-name')
self.framework.observe(self.on.start, self._on_start)
def _on_start(self, event):
try:
image_info = self.image.fetch()
except OCIImageResourceError as e:
self.model.unit.status = e.status
event.defer()
return
self.model.pod.set_spec({'containers': [{
'name': 'my-charm',
'imageDetails': image_info,
}]})
if __name__ == "__main__":
main(MyCharm)
Developing
Tests can be run with tox.
Metadata
Release files for oci-image 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| oci-image-1.0.0.tar.gz | 2.5 kB | Without provenance | Details for oci-image-1.0.0.tar.gz |
Release files / oci-image-1.0.0.tar.gz
| Download URL | oci-image-1.0.0.tar.gz |
|---|---|
| Size | 2.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a15a4a48dff6f1427429abffcd25ee13d1dfde41c8095e4635f53abe8ea53d15
|
|
BLAKE2b-256 checksum How to use checksums |
718ecffd8e05a6397d903e5d375c3cfc9228dacbf1a29ce70a5b5d21232f011b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2
|
Security for oci-image 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.