pulumi/pkg/cmd/pulumi
Kyle Pitzen 1a02b1b68d
Safeguards org search against unset default orgs (#13947)
<!--- 
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->

# Description

<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->

Currently, if a user has no default org set, and no org is provided via
--org, `GetBackendConfigDefaultOrg` returns nothing, which means no org
is provided when querying the Pulumi Cloud service - this results in a
404, and a nil pointer error when attempting to retrieve query
parameters from that API call. This falls back to the user name when no
org is provided by the user or retrieved by
`GetBackendConfigDefaultOrg`, as well as returning an error when one
arises from the service call rather than returning the error later.

## Checklist

- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
  - [ ] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-09-13 22:09:04 +00:00
..
convert_testdata Refactor convert command to add entrypoint for pulumi convert debugging 2022-10-01 15:40:17 -07:00
pcl_convert_testdata Support PCL as a convert input (and output) 2022-11-11 10:45:40 +00:00
testdata/fuzz/FuzzPowershellStackOutputWriter cli/stack-ouput/test: Fix Powershell test failures 2023-01-30 07:58:47 -08:00
about.go Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00
about_test.go Move about information to language plugins (#10392) 2022-08-15 14:55:04 +01:00
ai.go Kp/adds root pulumi ai command (#13808) 2023-09-05 23:18:03 +00:00
ai_web.go Addresses initial Org Search feedback (#13920) 2023-09-12 00:18:43 +00:00
cancel.go Support bailing from RunFunc (#13804) 2023-08-29 07:43:40 +00:00
config.go Pulumi no longer falls back on old configuration by default. 2023-07-19 14:50:49 -07:00
config_test.go Pulumi no longer falls back on old configuration by default. 2023-07-19 14:50:49 -07:00
console.go service to cloud 2023-04-08 09:49:37 -07:00
convert-trace.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
convert.go Make language-python it's own module (#13819) 2023-08-31 16:35:21 +00:00
convert_test.go Make convert more lenient 2023-06-08 11:14:31 +01:00
crypto.go Fix config set-all saving secret provider configuration 2023-04-12 15:21:29 +01:00
destroy.go Pulumi no longer falls back on old configuration by default. 2023-07-19 14:50:49 -07:00
doc.go Document Go packages (#6009) 2021-01-11 11:07:59 -07:00
env.go Support bailing from RunFunc (#13804) 2023-08-29 07:43:40 +00:00
errors.go Be more consistent about using ` for quoting commands (#10434) 2022-08-18 15:31:22 +01:00
gen_completion.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
gen_markdown.go add aliases to front matter 2023-05-17 16:04:51 -07:00
import.go Add args to state conversions (#13862) 2023-09-01 18:07:49 +00:00
import_test.go pulumi import: Print all errors in the file 2023-02-14 19:02:32 -08:00
login.go service to cloud 2023-04-08 09:49:37 -07:00
logout.go cli: Fix Markdown reference formatting issues 2023-06-20 15:24:15 -07:00
logs.go Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00
logs_test.go ci: radical idea - what if slow tests & no stdout makes GH consider runner dead? 2022-03-06 14:52:13 -08:00
main.go Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00
new.go cmdutil.ReadConsole[NoEcho]: Use bubbletea (#13815) 2023-08-30 17:08:44 +00:00
new_acceptance_test.go Fix `pulumi new` erroring when the project already exists. (#13786) 2023-08-29 18:01:51 +00:00
new_test.go Fix using backend in new when --generate-only is set 2023-07-20 08:59:49 +01:00
org.go Removes PULUMI_DEV flag for org search features (#13888) 2023-09-06 19:32:44 +00:00
org_search.go Safeguards org search against unset default orgs (#13947) 2023-09-13 22:09:04 +00:00
org_search_ai.go Addresses initial Org Search feedback (#13920) 2023-09-12 00:18:43 +00:00
org_search_ai_test.go Addresses initial Org Search feedback (#13920) 2023-09-12 00:18:43 +00:00
org_search_test.go Safeguards org search against unset default orgs (#13947) 2023-09-13 22:09:04 +00:00
package.go Add hidden sdk-pack command 2023-08-08 17:53:04 +01:00
package_extract_mapping.go Add get-mapping command 2023-06-12 17:11:52 +01:00
package_extract_schema.go Add gen-sdk sub-command 2022-09-14 17:07:05 +02:00
package_gen_sdk.go Make language-python it's own module (#13819) 2023-08-31 16:35:21 +00:00
package_pack_sdk.go Add hidden sdk-pack command 2023-08-08 17:53:04 +01:00
package_publish.go additional comment as per review 2023-06-01 10:00:31 -07:00
plugin.go Warn about ambient plugins loaded from $PATH 2023-08-08 13:11:34 +01:00
plugin_install.go Check if Plugin is bundled before installing 2023-08-07 15:33:12 +01:00
plugin_install_test.go Check if Plugin is bundled before installing 2023-08-07 15:33:12 +01:00
plugin_ls.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
plugin_rm.go Adjust output to be more readable 2023-06-20 10:34:56 -07:00
policy.go [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
policy_disable.go Move cancellation_scope to backend 2023-05-09 13:01:42 +01:00
policy_enable.go Move cancellation_scope to backend 2023-05-09 13:01:42 +01:00
policy_group_ls.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
policy_ls.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
policy_new.go [policy/new] make `pulumi policy new <template-name>` runnable in non-interactive mode (#13902) 2023-09-09 00:58:16 +00:00
policy_new_acceptance_test.go [policy/new] make `pulumi policy new <template-name>` runnable in non-interactive mode (#13902) 2023-09-09 00:58:16 +00:00
policy_new_test.go [policy/new] make `pulumi policy new <template-name>` runnable in non-interactive mode (#13902) 2023-09-09 00:58:16 +00:00
policy_publish.go Move cancellation_scope to backend 2023-05-09 13:01:42 +01:00
policy_rm.go Support bailing from RunFunc (#13804) 2023-08-29 07:43:40 +00:00
policy_validate.go Move cancellation_scope to backend 2023-05-09 13:01:42 +01:00
preview.go Consolidated Target parameters 2023-06-08 08:42:03 -07:00
pulumi.go Kp/adds root pulumi ai command (#13808) 2023-09-05 23:18:03 +00:00
pulumi_test.go {cli, httpstate}: Don't retry GetCLIVersionInfo 2023-06-20 10:08:33 -07:00
query.go Move cancellation_scope to backend 2023-05-09 13:01:42 +01:00
refresh.go Replace Bail result with BailError (#13811) 2023-08-30 13:18:54 +00:00
replay_events.go [cli] Add an "open in browser" keybinding 2023-03-09 15:52:13 -08:00
schema.go [codegen/schema] Add a schema checker (#7865) 2021-08-30 19:29:24 -07:00
schema_check.go all: Drop ioutil 2023-01-06 16:35:14 -08:00
stack.go Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00
stack_change_secrets_provider.go Add tests for stackChangeSecretsProviderCmd (#13791) 2023-08-31 08:56:38 +00:00
stack_change_secrets_provider_test.go Add tests for stackChangeSecretsProviderCmd (#13791) 2023-08-31 08:56:38 +00:00
stack_export.go cmd: Reduce noise from offerNew, setCurrent bool 2023-01-20 15:34:39 -08:00
stack_graph.go Push DefaultSecretsProvider up to pkg/cmd 2023-01-27 12:04:52 +00:00
stack_history.go Fix config set-all saving secret provider configuration 2023-04-12 15:21:29 +01:00
stack_import.go Add `pulumi state edit` utility. 2023-07-17 09:47:05 -07:00
stack_init.go service to cloud 2023-04-08 09:49:37 -07:00
stack_init_test.go service to cloud 2023-04-08 09:49:37 -07:00
stack_ls.go Pass *Project to currentBackend 2023-02-17 13:20:38 +00:00
stack_ls_test.go pkg/backend: Add MockStackReference implementation 2023-03-27 09:29:52 -07:00
stack_output.go Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00
stack_output_fuzz_test.go cli/stack-ouput/test: Fix Powershell test failures 2023-01-30 07:58:47 -08:00
stack_output_test.go fix(cli/stack output): Don't escape HTML characters 2023-06-23 09:11:20 -07:00
stack_rename.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
stack_rm.go Support bailing from RunFunc (#13804) 2023-08-29 07:43:40 +00:00
stack_select.go Set the current project as ambient context on backends. 2023-03-03 20:32:42 +00:00
stack_tag.go Use slice.Prealloc instead of make([]T, 0, ...) 2023-06-29 11:27:50 +01:00
stack_test.go fix(cli/stack output): Don't escape HTML characters 2023-06-23 09:11:20 -07:00
stack_unselect.go include error in formatted message and explicitly check for an empty stack 2022-03-14 11:32:33 +01:00
state.go Replace Bail result with BailError (#13811) 2023-08-30 13:18:54 +00:00
state_delete.go Replace Bail result with BailError (#13811) 2023-08-30 13:18:54 +00:00
state_edit.go [`pulumi state edit`] handle multi-part EDITOR variables (i.e. `emacs -nw`) (#13922) 2023-09-12 15:34:03 +00:00
state_edit_encoder.go Add `pulumi state edit` utility. 2023-07-17 09:47:05 -07:00
state_edit_test.go [`pulumi state edit`] handle multi-part EDITOR variables (i.e. `emacs -nw`) (#13922) 2023-09-12 15:34:03 +00:00
state_rename.go Replace Bail result with BailError (#13811) 2023-08-30 13:18:54 +00:00
state_rename_test.go Adjust test to new input type 2023-06-28 14:14:25 +02:00
state_unprotect.go Replace Bail result with BailError (#13811) 2023-08-30 13:18:54 +00:00
state_upgrade.go cli(state upgrade): Prompt for project names for detached stacks 2023-06-22 13:45:13 -07:00
state_upgrade_test.go cli(state upgrade): Prompt for project names for detached stacks 2023-06-22 13:45:13 -07:00
terminal.go crypto/ssh/terminal is deprecated 2023-01-12 09:07:34 -08:00
terminal_test.go Fix negative page size panic (#10475) 2022-08-23 16:45:47 -04:00
up.go Don't save empty config values to the config file in new 2023-06-22 09:20:55 +01:00
up_test.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
util.go Replace Bail result with BailError (#13811) 2023-08-30 13:18:54 +00:00
util_remote.go service to cloud 2023-04-08 09:49:37 -07:00
util_remote_test.go [cli] Experimental support for remote operations 2022-10-27 16:15:59 -07:00
util_test.go chore: Share unescaped JSON logic with makeJSONString 2023-06-23 09:52:06 -07:00
version.go [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
view-trace.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
watch.go Move cancellation_scope to backend 2023-05-09 13:01:42 +01:00
whoami.go cmd/whoami: Override stdout and currentBackend, add tests 2023-03-09 10:20:47 -08:00
whoami_test.go cmd/whoami: Override stdout and currentBackend, add tests 2023-03-09 10:20:47 -08:00