From 7650e3dce82ac25c6efe64fb5fbb15c3b56d72c5 Mon Sep 17 00:00:00 2001 From: Oleksii Prudkyi Date: Sat, 22 Apr 2023 20:36:06 +0300 Subject: [PATCH] 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 --- internal/command/init.go | 2 +- internal/providercache/installer.go | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/internal/command/init.go b/internal/command/init.go index 2e6d13d9da..5b415015be 100644 --- a/internal/command/init.go +++ b/internal/command/init.go @@ -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 { diff --git a/internal/providercache/installer.go b/internal/providercache/installer.go index 62e57cc2b2..d6a2b5af13 100644 --- a/internal/providercache/installer.go +++ b/internal/providercache/installer.go @@ -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 {