diff --git a/src/app/cli/src/commands/login_command.rs b/src/app/cli/src/commands/login_command.rs index 2044e51b5..1d396668d 100644 --- a/src/app/cli/src/commands/login_command.rs +++ b/src/app/cli/src/commands/login_command.rs @@ -60,15 +60,17 @@ impl LoginCommand { fn new_login_with_token( &self, - odf_server_frontend_url: &Url, + odf_server_backend_url: &Url, access_token: &str, ) -> Result<(), CLIError> { self.access_token_registry_service.save_access_token( self.scope, - Some(odf_server_frontend_url), - odf_server_frontend_url, + Some(odf_server_backend_url), + odf_server_backend_url, access_token.to_string(), )?; + self.add_repository(odf_server_backend_url, odf_server_backend_url)?; + Ok(()) } diff --git a/src/app/cli/src/commands/push_command.rs b/src/app/cli/src/commands/push_command.rs index ece086617..eece2a8b8 100644 --- a/src/app/cli/src/commands/push_command.rs +++ b/src/app/cli/src/commands/push_command.rs @@ -92,6 +92,9 @@ impl PushCommand { repo_name_maybe } else { let remote_repo_names: Vec<_> = self.remote_repo_reg.get_all_repositories().collect(); + if remote_repo_names.len() > 1 { + return Ok(None); + } remote_repo_names.first().cloned() }; if let Some(remote_repo_name) = repo_name { diff --git a/src/app/cli/src/services/odf_server/login_service.rs b/src/app/cli/src/services/odf_server/login_service.rs index 75acc5c36..357e607e8 100644 --- a/src/app/cli/src/services/odf_server/login_service.rs +++ b/src/app/cli/src/services/odf_server/login_service.rs @@ -280,19 +280,22 @@ impl LoginService { let gql_query = r#" { - accounts { - byAccessToken( - accessToken: "{access_token}" - ) { - id - accountName - displayName - accountType - avatarUrl - isAdmin + accounts { + byAccessToken( + accessToken: "{access_token}" + ) { + isMultiTenant + account { + id + accountName + displayName + accountType + avatarUrl + isAdmin + } + } } - } - } + } "# .replace("{access_token}", access_token); diff --git a/src/infra/core/src/push_service_impl.rs b/src/infra/core/src/push_service_impl.rs index 78fcb8a01..8f5f42df2 100644 --- a/src/infra/core/src/push_service_impl.rs +++ b/src/infra/core/src/push_service_impl.rs @@ -157,19 +157,18 @@ impl PushServiceImpl { } else { local_handle.alias.dataset_name.clone() }; - let dataset_alias = DatasetAlias::new( - remote_repo_opts.remote_account_name.clone(), - push_dataset_name, - ); let mut res_url = remote_repo_opts .remote_repo_url .clone() .as_odf_protoocol() .unwrap(); + if let Some(account_name) = &remote_repo_opts.remote_account_name { + res_url.path_segments_mut().unwrap().push(account_name); + } res_url .path_segments_mut() .unwrap() - .push(&dataset_alias.to_string()); + .push(&push_dataset_name); return Ok(res_url.into()); } Err(PushError::NoTarget)