Skip to content

Commit

Permalink
Merge pull request #1103 from rphillips/backports/1086
Browse files Browse the repository at this point in the history
[release-4.1] Bug 1749271: Backport mcd: Add /run/machine-config-daemon-force stampfile #1086
  • Loading branch information
openshift-merge-robot committed Sep 6, 2019
2 parents 916adbf + b6162e7 commit a004938
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions pkg/daemon/constants/constants.go
Expand Up @@ -34,4 +34,9 @@ const (
// EtcPivotFile is used by the `pivot` command
// For more information, see https://github.com/openshift/pivot/pull/25/commits/c77788a35d7ee4058d1410e89e6c7937bca89f6c#diff-04c6e90faac2675aa89e2176d2eec7d8R44
EtcPivotFile = "/etc/pivot/image-pullspec"

// 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 @@ -913,8 +913,12 @@ func (dn *Daemon) CheckStateOnBoot() 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 {
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

0 comments on commit a004938

Please sign in to comment.