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

base/v0_2: add sugar to embed Resource from a local file #99

Merged
merged 8 commits into from
May 7, 2020
Merged

base/v0_2: add sugar to embed Resource from a local file #99

merged 8 commits into from
May 7, 2020

Conversation

bgilbert
Copy link
Contributor

@bgilbert bgilbert commented May 5, 2020

If local is specified instead of source or inline, read a local file from a base directory and encode it into a data URI. We require the base directory to be specified on the command line, so that transpiling untrusted configs doesn't leak information from the host system by default.

This required plumbing an options struct into custom translators, and plumbing error returns (via a report.Report) back out.

Fixes #83.

We can just add translateResource to the parent.
They have an unused error return right now.  Convert them to returning
a Report.
We'll need these when tr.Translate() starts returning multiple values.
Custom translators might fail if they're doing something at runtime that
can't be checked during the validation pass, e.g. reading from an
external file.  Have custom translators return a Report, and plumb it
through to translate.Translate().
Copy link
Contributor

@lucab lucab left a comment

Choose a reason for hiding this comment

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

Overall it looks sane, I only have a minor options-plumbing doubt.

config/common/common.go Outdated Show resolved Hide resolved
Have NewTranslator() take an options interface{}, and pass it to
any custom translators registered against that translator.  Ensure that
all such custom translators take an options argument with a compatible
type.

Embed a base options struct in common.TranslateOptions and pass it
to the translators.
base/v0_2_exp/translate.go Outdated Show resolved Hide resolved
docs/configuration-v1_1-exp.md Outdated Show resolved Hide resolved
If `local` is specified instead of `source` or `inline`, read a local
file from a base directory and encode it into a data URI.  We require the
base directory to be specified on the command line, so that transpiling
untrusted configs doesn't leak information from the host system by
default.
Extend base verifyTranslations() to ensure that all listed exceptions are
actually present.
@bgilbert
Copy link
Contributor Author

bgilbert commented May 6, 2020

Updated.

@joyartoun
Copy link

joyartoun commented May 14, 2020

Hi!
I am dependent on a release of fcct to be able to use this feature. I see that there is no official release made since this feature got merged into the master branch. Do you know when there will be a official release?

/J

@bgilbert
Copy link
Contributor Author

@joyartoun Hopefully within the next couple weeks.

@lucab lucab mentioned this pull request Jun 3, 2020
gdonval added a commit to gdonval/fedora-coreos-docs that referenced this pull request Mar 3, 2021
The token `local` has been available since coreos/butane#99 but the documentation did not reflect that.
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.

Workaround for local file contents
4 participants