OpenStack Config Resolver (modules/openstack.rs)

starship · src/modules/openstack.rs · rust · ISC
integration, infra, cli, lang:rust, tag:openstack, tag:config

Locates and parses OpenStack clouds.yaml to extract cloud and project names for the current context, enabling CLI tools to interact with OpenStack services.

// Source: https://github.com/starship/starship | License: ISC | Copyright 2019-2022, Starship Contributors
// Provided via justclaw.it.com; keep this notice with the code.
use std::path::PathBuf;

use yaml_rust2::YamlLoader;

use super::{Context, Module, ModuleConfig};

use crate::configs::openstack::OspConfig;
use crate::formatter::StringFormatter;
use crate::utils;

type Cloud = String;
type Project = String;

fn get_osp_project_from_config(context: &Context, osp_cloud: &str) -> Option<Project> {
    // Attempt to follow OpenStack standards for clouds.yaml location:
    // 1st = current directory, 2nd = $HOME/.config/openstack/clouds.yaml, 3rd = /etc/openstack/clouds.yaml
    let config = [
        Some(context.current_dir.join("clouds.yaml")),
        context
            .get_home()
  

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key