From 23608c2069b473599fbe1a4ae555cf2c6de6ab56 Mon Sep 17 00:00:00 2001 From: Ian Wahbe Date: Tue, 29 Nov 2022 14:07:03 -0800 Subject: [PATCH] Qualify name --- pkg/backend/backend.go | 4 ++-- pkg/backend/filestate/backend.go | 4 ++-- pkg/backend/httpstate/stack.go | 4 ++-- pkg/cmd/pulumi/about.go | 5 ++--- pkg/cmd/pulumi/stack_ls_test.go | 4 ++-- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/pkg/backend/backend.go b/pkg/backend/backend.go index ce2c82957e66..495f7fa5a770 100644 --- a/pkg/backend/backend.go +++ b/pkg/backend/backend.go @@ -76,8 +76,8 @@ type StackReference interface { // but that information is not part of the StackName() we pass to the engine. Name() tokens.Name - // Fully qualified name is the name - FullyQualifiedName() tokens.Name + // Fully qualified name of the stack. + FullyQualifiedName() tokens.QName } // PolicyPackReference is an opaque type that refers to a PolicyPack managed by a backend. The CLI diff --git a/pkg/backend/filestate/backend.go b/pkg/backend/filestate/backend.go index 37e5283c0b89..a1abc41ad25a 100644 --- a/pkg/backend/filestate/backend.go +++ b/pkg/backend/filestate/backend.go @@ -99,8 +99,8 @@ func (r localBackendReference) Name() tokens.Name { return r.name } -func (r localBackendReference) FullyQualifiedName() tokens.Name { - return r.Name() +func (r localBackendReference) FullyQualifiedName() tokens.QName { + return r.Name().Q() } func IsFileStateBackendURL(urlstr string) bool { diff --git a/pkg/backend/httpstate/stack.go b/pkg/backend/httpstate/stack.go index 0743f00caa16..c2542915a764 100644 --- a/pkg/backend/httpstate/stack.go +++ b/pkg/backend/httpstate/stack.go @@ -74,8 +74,8 @@ func (c cloudBackendReference) Name() tokens.Name { return c.name } -func (c cloudBackendReference) FullyQualifiedName() tokens.Name { - return tokens.Name(fmt.Sprintf("%v/%v/%v", c.owner, c.project, c.name.String())) +func (c cloudBackendReference) FullyQualifiedName() tokens.QName { + return tokens.IntoQName(fmt.Sprintf("%v/%v/%v", c.owner, c.project, c.name.String())) } // cloudStack is a cloud stack descriptor. diff --git a/pkg/cmd/pulumi/about.go b/pkg/cmd/pulumi/about.go index 754be9509273..676fac6808bc 100644 --- a/pkg/cmd/pulumi/about.go +++ b/pkg/cmd/pulumi/about.go @@ -188,7 +188,6 @@ func getSummaryAbout(ctx context.Context, transitiveDependencies bool, selectedS tmp := getBackendAbout(backend) result.Backend = &tmp } - return result } @@ -427,8 +426,8 @@ func (current currentStackAbout) String() string { }.String() + "\n" } stackName := current.Name - if stackName != current.FullyQualifiedName { - stackName += fmt.Sprintf(" (fully qualified to %q)", current.FullyQualifiedName) + if current.FullyQualifiedName != "" { + stackName = current.FullyQualifiedName } return fmt.Sprintf("Current Stack: %s\n\n%s\n%s", stackName, resources, pending) } diff --git a/pkg/cmd/pulumi/stack_ls_test.go b/pkg/cmd/pulumi/stack_ls_test.go index 85f94f8a4933..2152a2281535 100644 --- a/pkg/cmd/pulumi/stack_ls_test.go +++ b/pkg/cmd/pulumi/stack_ls_test.go @@ -82,8 +82,8 @@ func (msr *mockStackReference) Name() tokens.Name { return tokens.Name(msr.name) } -func (msr *mockStackReference) FullyQualifiedName() tokens.Name { - return msr.Name() +func (msr *mockStackReference) FullyQualifiedName() tokens.QName { + return msr.Name().Q() } func (msr *mockStackReference) String() string {