pub fn find_upgradeable_version() -> Result<Option<Version>> {
        // We should always be able to read fallback ConfigFallback:
        let fb = match Self::read() {
            Ok(cfg) => cfg,
            Err(e) => {
                error!("shipcat.conf versions unreadable - manifests out of date?");
                bail!("shipcat.conf could not be read even in fallback mode: {}", e);
            }
        };
        // If only fallback ok, a schema change probably caused it.
        // Check if our shipcat is out of date:
        match fb.versions.values().min() {
            None => bail!("Failed to understand version pin in shipcat.conf - needs at least one pin"),
            Some(lowest) => {
                let current = Version::parse(env!("CARGO_PKG_VERSION")).unwrap();
                if *lowest > current {
                    return Ok(Some(lowest.to_owned()));
                }
                // otherwise.. we are up to date - unfortunately.
            }
        }
        Ok(None)
    }
/// Safety path when shipcat.conf is unreadeable due to schema changes
///
/// Allows main to identify an upgrade path without a working Config
Safety path when shipcat.conf is unreadeable due to schema changes
Allows main to identify an upgrade path without a working Config
Safety path when shipcat . conf is unreadeable due to schema changes Allows main to identify an upgrade path without a working Config
pub fn find_upgradeable_version() -> Result<Option<Version>> {
        // We should always be able to read fallback ConfigFallback:
        let fb = match Self::read() {
            Ok(cfg) => cfg,
            Err(e) => {
                error!("shipcat.conf versions unreadable - manifests out of date?");
                bail!("shipcat.conf could not be read even in fallback mode: {}", e);
            }
        };
        // If only fallback ok, a schema change probably caused it.
        // Check if our shipcat is out of date:
        match fb.versions.values().min() {
            None => bail!("Failed to understand version pin in shipcat.conf - needs at least one pin"),
            Some(lowest) => {
                let current = Version::parse(env!("CARGO_PKG_VERSION")).unwrap();
                if *lowest > current {
                    return Ok(Some(lowest.to_owned()));
                }
                // otherwise.. we are up to date - unfortunately.
            }
        }
        Ok(None)
    }
pub fn find_upgradeable_version ( ) -> Result < Option < Version > > { // We should always be able to read fallback ConfigFallback: let fb = match Self :: read ( ) { Ok ( cfg ) => cfg , Err ( e ) => { error ! ( " " ) ; bail ! ( " " e ) ; } } ; // If only fallback ok, a schema change probably caused it. // Check if our shipcat is out of date: match fb . versions . values ( ) . min ( ) { None => bail ! ( " " ) , Some ( lowest ) => { let current = Version :: parse ( env ! ( " " ) ) . unwrap ( ) ; if * lowest > current { return Ok ( Some ( lowest . to_owned ( ) ) ) ; } // otherwise.. we are up to date - unfortunately. } } Ok ( None ) }
Safety path when shipcat.conf is unreadeable due to schema changes
Allows main to identify an upgrade path without a working Config
Safety path when shipcat . conf is unreadeable due to schema changes Allows main to identify an upgrade path without a working Config