@@ -77,9 +77,6 @@ type Daemon struct {
77
77
// bootedOSImageURL is the currently booted URL of the operating system
78
78
bootedOSImageURL string
79
79
80
- // bootedOScommit is the commit hash of the currently booted operating system
81
- bootedOSCommit string
82
-
83
80
// previousFinalizationFailure caches a failure of ostree-finalize-staged.service
84
81
// we may have seen from the previous boot.
85
82
previousFinalizationFailure string
@@ -347,7 +344,6 @@ func New(
347
344
os : hostos ,
348
345
NodeUpdaterClient : nodeUpdaterClient ,
349
346
bootedOSImageURL : osImageURL ,
350
- bootedOSCommit : osCommit ,
351
347
bootID : bootID ,
352
348
exitCh : exitCh ,
353
349
currentConfigPath : currentConfigPath ,
@@ -2653,7 +2649,7 @@ func (dn *Daemon) validateOnDiskStateImpl(currentConfig *mcfgv1.MachineConfig, i
2653
2649
// Be sure we're booted into the OS we expect
2654
2650
osMatch := dn .checkOS (imageToCheck )
2655
2651
if ! osMatch {
2656
- return fmt .Errorf ("expected target osImageURL %q, have %q (%q) " , imageToCheck , dn .bootedOSImageURL , dn . bootedOSCommit )
2652
+ return fmt .Errorf ("expected target osImageURL %q, have %q" , imageToCheck , dn .bootedOSImageURL )
2657
2653
}
2658
2654
2659
2655
if dn .os .IsCoreOSVariant () {
@@ -2731,16 +2727,9 @@ func (dn *Daemon) checkOS(osImageURL string) bool {
2731
2727
return true
2732
2728
}
2733
2729
2734
- // TODO(jkyros): the header for this functions says "if the digests match"
2735
- // so I'm wondering if at one point this used to work this way....
2736
- inspection , _ , err := ImageInspect (osImageURL , "" )
2737
- if err != nil {
2738
- klog .Warningf ("Unable to check manifest for matching hash: %s" , err )
2739
- } else if ostreeCommit , ok := inspection .Labels ["ostree.commit" ]; ok {
2740
- if ostreeCommit == dn .bootedOSCommit {
2741
- klog .Infof ("We are technically in the right image even if the URL doesn't match (%s == %s)" , ostreeCommit , osImageURL )
2742
- return true
2743
- }
2730
+ if ! strings .Contains (osImageURL , "sha256:" ) {
2731
+ // This is for info gathering purposes
2732
+ klog .Warningf ("osImageURL %q is not a digest; using a digest is recommended" , osImageURL )
2744
2733
}
2745
2734
2746
2735
return dn .bootedOSImageURL == osImageURL
0 commit comments