import type { MlClient } from '../../lib/ml_client' ; import { mlLog } from '../../lib/log' ; export function upgradeCheckProvider ( mlClient ) { async function isUpgradeInProgress ( ) { let upgradeInProgress = false ; try { const { body } = await mlClient . info ( ) ; upgradeInProgress = body . upgrade_mode === true ; } catch ( error ) { if ( error . status === 403 ) { mlLog . info ( 'Unable to determine whether upgrade is being performed due to insufficient user privileges' ) ; } else { mlLog . warn ( 'Unable to determine whether upgrade is being performed' ) ; } } return upgradeInProgress ; } return { isUpgradeInProgress } ; }