cli init: hide warning about incomplete lock

when plugin_cache_may_break_dependency_lock_file is enabled don't show
`Warning: Incomplete lock file information for providers` and description
This commit is contained in:
Oleksii Prudkyi 2023-04-22 20:36:06 +03:00
parent c81aef3655
commit 7650e3dce8
2 changed files with 9 additions and 1 deletions

View file

@ -877,7 +877,7 @@ func (c *InitCommand) getProviders(config *configs.Config, state *states.State,
}
// Jump in here and add a warning if any of the providers are incomplete.
if len(incompleteProviders) > 0 {
if len(incompleteProviders) > 0 && !inst.GlobalCacheDirMayBreakDependencyLockFile() {
// We don't really care about the order here, we just want the
// output to be deterministic.
sort.Slice(incompleteProviders, func(i, j int) bool {

View file

@ -123,6 +123,14 @@ func (i *Installer) SetGlobalCacheDirMayBreakDependencyLockFile(mayBreak bool) {
i.globalCacheDirMayBreakDependencyLockFile = mayBreak
}
// GlobalCacheDirMayBreakDependencyLockFile returns true when
// temporary exception to the rule that the global cache directory can be used
// only when entries are confirmed by existing entries in the dependency lock
// file is activated.
func (i *Installer) GlobalCacheDirMayBreakDependencyLockFile() bool {
return i.globalCacheDirMayBreakDependencyLockFile
}
// HasGlobalCacheDir returns true if someone has previously called
// SetGlobalCacheDir to configure a global cache directory for this installer.
func (i *Installer) HasGlobalCacheDir() bool {