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

Add methods to retrieve raw bundle string #427

Merged

Conversation

jack-w-shaw
Copy link
Member

@jack-w-shaw jack-w-shaw commented May 9, 2024

Add this RawBundle method to Bundle interface and BundleDataSource

In Juju, we have come across a need to run some extra parsing + verification which we do not want to do in juju/charm. We want to keep the data model clean in juju/charm.

As such, we need to way to keep the raw bundle data around for later parsing

Add this to BundleDataSource, as this is what we use in Juju

However, we also implement our own BundleDataSource in Juju. built with the Bundle interface here. So we need to add this method to Bundle as well

You can see a draft implementation for this change here:
juju/juju#17350

As a flyby, delete some incorrect comments

QA Steps

Compile into juju form the following PR and run it's QA steps:
juju/juju#17350

@jack-w-shaw jack-w-shaw marked this pull request as ready for review May 9, 2024 12:45
@jack-w-shaw jack-w-shaw force-pushed the JUJU-5926_add_method_to_retreive_raw_bundle branch from 6f7af24 to 6ba7add Compare May 9, 2024 13:36
bundle.go Outdated
@@ -15,6 +15,8 @@ import (
type Bundle interface {
// Data returns the contents of the bundle's bundle.yaml file.
Data() *BundleData
// RawBundle returns the raw string content of a bundle
RawBundle() string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm struggling to like this name. Maybe BundleBytes()?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's fair

I'll obviously change the return type to []byte as well

Add this BundleBytes method to Bundle interface and BundleDataSource

In Juju, we have come across a need to run some extra parsing +
verification which we do not want to do in juju/charm. We want to keep
the data model clean in juju/charm.

As such, we need to way to keep the raw bundle data around for later
parsing

Add this to BundleDataSource, as this is what we use in Juju

However, we also implement our own BundleDataSource in Juju. built with
the Bundle interface here. So we need to add this method to Bundle as
well
@jack-w-shaw jack-w-shaw force-pushed the JUJU-5926_add_method_to_retreive_raw_bundle branch from 6ba7add to 3845e5d Compare May 21, 2024 11:15
@jack-w-shaw
Copy link
Member Author

/merge

@jujubot jujubot merged commit 8920fe1 into juju:v13 May 21, 2024
1 of 2 checks passed
@jack-w-shaw jack-w-shaw deleted the JUJU-5926_add_method_to_retreive_raw_bundle branch May 21, 2024 12:50
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.

3 participants