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

Bug 1741817: mcd: Add /run/machine-config-daemon-force stamp file #1086

Merged
merged 1 commit into from Aug 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions pkg/daemon/constants/constants.go
Expand Up @@ -40,4 +40,9 @@ const (
// object so that Ignition can process it on first boot, and then the MCD can act on
// non-Ignition fields such as the osImageURL and kernelArguments.
MachineConfigEncapsulatedPath = "/etc/ignition-machine-config-encapsulated.json"

// MachineConfigDaemonForceFile if present causes the MCD to skip checking the validity of the
// "currentConfig" state. Create this file (empty contents is fine) if you wish the MCD
// to proceed and attempt to "reconcile" to the new "desiredConfig" state regardless.
MachineConfigDaemonForceFile = "/run/machine-config-daemon-force"
)
8 changes: 6 additions & 2 deletions pkg/daemon/daemon.go
Expand Up @@ -892,8 +892,12 @@ func (dn *Daemon) checkStateOnFirstRun() error {
glog.Infof("Validating against current config %s", state.currentConfig.GetName())
expectedConfig = state.currentConfig
}
if !dn.validateOnDiskState(expectedConfig) {
return fmt.Errorf("unexpected on-disk state validating against %s", expectedConfig.GetName())
if _, err := os.Stat(constants.MachineConfigDaemonForceFile); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we be more specific about the type of error here? Also is there a way to force when there's some issue preventing reading or setting this file successfully?

if !dn.validateOnDiskState(expectedConfig) {
return fmt.Errorf("unexpected on-disk state validating against %s", expectedConfig.GetName())
}
} else {
glog.Infof("Skipping on-disk validation; %s present", constants.MachineConfigDaemonForceFile)
}
glog.Info("Validated on-disk state")

Expand Down