Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions openstack_cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ pub struct ConnectionOpts {
#[arg(long, env = "OS_PROJECT_NAME", global = true, display_order = 803)]
pub os_project_name: Option<String>,

/// Region Name to use instead of the one in the connection profile.
#[arg(long, env = "OS_REGION_NAME", global = true, display_order = 804)]
pub os_region_name: Option<String>,

/// Custom path to the `clouds.yaml` config file.
#[arg(
long,
Expand Down
6 changes: 5 additions & 1 deletion openstack_cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ pub async fn entry_point() -> Result<(), OpenStackCliError> {
.with(rtl)
.init();

let cloud_config = if cli.global_opts.connection.cloud_config_from_env {
let mut cloud_config = if cli.global_opts.connection.cloud_config_from_env {
// Environment variables should be used to get the cloud configuration
tracing::debug!("Using environment variables for the cloud connection");
let cloud_name = cli
Expand Down Expand Up @@ -152,6 +152,10 @@ pub async fn entry_point() -> Result<(), OpenStackCliError> {
cfg.get_cloud_config(&cloud_name)?
.ok_or(OpenStackCliError::ConnectionNotFound(cloud_name.clone()))?
};
if let Some(region_name) = &cli.global_opts.connection.os_region_name {
cloud_config.region_name = Some(region_name.clone());
}

let mut renew_auth: bool = false;

// Login command need to be analyzed before authorization
Expand Down