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

engine: fix logging interactions with fetch-offline #1075

Merged
merged 2 commits into from
Sep 9, 2020

Conversation

jlebon
Copy link
Member

@jlebon jlebon commented Aug 21, 2020

Right now, even if fetch-offline gets ErrNeedNet, it might've still
logged info about configs which it did fetch before hitting the error.
This then results in double-logging of e.g. the base config and at least
the first layer of user configs when fetch re-fetches them.

But it's also misleading, because anything which runs between
fetch-offline and fetch and sees the journal messages will think
that Ignition did successfully fetch and cache the merged user config,
when it did not.

And sadly, we still have code which peek at the cached config for
$reasons (legacy-style RHCOS LUKS is one of them, RHCOS FIPS support
is another), and those bits get thrown off by seeing the logging
messages yet not seeing a cached Ignition config.

Let's tweak things so that we buffer those messages and only actually
write them out once we've successfully acquired the configs.

While we're here, clean up the base config logging hack now that the
fetch stages are canonical.

Right now, even if `fetch-offline` gets `ErrNeedNet`, it might've still
logged info about configs which it did fetch before hitting the error.
This then results in double-logging of e.g. the base config and at least
the first layer of user configs when `fetch` re-fetches them.

But it's also misleading, because anything which runs between
`fetch-offline` and `fetch` and sees the journal messages will think
that Ignition did successfully fetch and cache the merged user config,
when it did not.

And sadly, we still have code which peek at the cached config for
`$reasons` (legacy-style RHCOS LUKS is one of them, RHCOS FIPS support
is another), and those bits get thrown off by seeing the logging
messages yet not seeing a cached Ignition config.

Let's tweak things so that we buffer those messages and only actually
write them out once we've successfully acquired the configs.

While we're here, clean up the base config logging hack now that the
`fetch` stages are canonical.
@jlebon
Copy link
Member Author

jlebon commented Aug 21, 2020

Only compile-tested for now.

@cgwalters
Copy link
Member

Using the journal to communicate is trickier than we thought. Well, I guess in general all IPC is tricky.

Problem description makes total sense to me. The patch looks right to me superficially but I don't know the fetch code very well.

@jlebon jlebon marked this pull request as ready for review August 28, 2020 21:43
@jlebon
Copy link
Member Author

jlebon commented Aug 28, 2020

OK, tested this now and ready for review! And also added another commit which fixes something else worth mentioning: in cases where fetch-offline did successfully fetch a config, we were sometimes still running the fetch stage, which would re-fetch the config from the provider. Tightened that up!

Copy link
Member

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

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

It's possible that `fetch-offline` does successfully fetch and cache a
config but still touch `/run/ignition/neednet`. That stamp file is an
API between Ignition and the OS that Ignition will need networking to
fully process it. But the config itself might've successfully been
fetched (and the only thing that requires networking is e.g. a remote
file). In those cases, there's no point in running `fetch` and have it
query the provider again.
@jlebon jlebon merged commit 9c0b382 into coreos:master Sep 9, 2020
@jlebon jlebon deleted the pr/logging-tweaks branch September 9, 2020 13:44
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