ignore provider check in init repo (#3753)

<!-- PR description-->

don't check after fetching account type for repo init command

#### Does this PR need a docs update or release note?

- [x]  No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [x] 🐛 Bugfix

#### Issue(s)

<!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. -->


#### Test Plan

<!-- How will this be tested prior to merging.-->
- [x]  Unit test
This commit is contained in:
neha_gupta 2023-07-05 12:13:05 +05:30 committed by GitHub
parent cce7d4e0ad
commit e69d389aaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,11 +16,6 @@ import (
func m365ConfigsFromViper(vpr *viper.Viper) (account.M365Config, error) { func m365ConfigsFromViper(vpr *viper.Viper) (account.M365Config, error) {
var m365 account.M365Config var m365 account.M365Config
providerType := vpr.GetString(AccountProviderTypeKey)
if providerType != account.ProviderM365.String() {
return m365, clues.New("unsupported account provider: " + providerType)
}
m365.AzureClientID = vpr.GetString(AzureClientID) m365.AzureClientID = vpr.GetString(AzureClientID)
m365.AzureClientSecret = vpr.GetString(AzureSecret) m365.AzureClientSecret = vpr.GetString(AzureSecret)
m365.AzureTenantID = vpr.GetString(AzureTenantIDKey) m365.AzureTenantID = vpr.GetString(AzureTenantIDKey)
@ -58,6 +53,11 @@ func configureAccount(
} }
if matchFromConfig { if matchFromConfig {
providerType := vpr.GetString(AccountProviderTypeKey)
if providerType != account.ProviderM365.String() {
return acct, clues.New("unsupported account provider: " + providerType)
}
if err := mustMatchConfig(vpr, m365Overrides(overrides)); err != nil { if err := mustMatchConfig(vpr, m365Overrides(overrides)); err != nil {
return acct, clues.Wrap(err, "verifying m365 configs in corso config file") return acct, clues.Wrap(err, "verifying m365 configs in corso config file")
} }