From 02ade8608c75ae8e25f89b4d660ba73f0493cca3 Mon Sep 17 00:00:00 2001 From: Thilo Fromm Date: Tue, 27 Feb 2024 12:45:50 +0100 Subject: [PATCH] Azure-Init: rename to azure-init (#41) This change renames the project to azure-init. We also bump the version to 0.1.1 to signify the change. Signed-off-by: Thilo Fromm --- .github/workflows/ci.yaml | 4 +-- .gitignore | 2 +- CONTRIBUTING.md | 2 +- Cargo.toml | 7 ++--- README.md | 14 +++++----- SUPPORT.md | 36 ++++++++++++------------- config/azure-provisioning-agent.service | 6 ++--- demo/customdata_template.yml | 8 +++--- demo/image_creation.sh | 20 +++++++------- src/goalstate.rs | 10 ++----- src/media.rs | 10 +++---- 11 files changed, 57 insertions(+), 62 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 49dd1a5..c519ee8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,7 +9,7 @@ on: jobs: build-test: - name: Build and test azure-provisioning-agent + name: Build and test azure-init runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -24,7 +24,7 @@ jobs: with: command: fmt args: --all --check - - name: Build azure-provisioning-agent + - name: Build azure-init uses: actions-rs/cargo@v1 with: command: build diff --git a/.gitignore b/.gitignore index e46fbb0..5635d23 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,4 @@ Cargo.lock *.pdb # .tgz Files are used for creating the image and are auto generated by the script -azure-provisioning-agent.tgz +azure-init.tgz diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2b77adf..3d8f233 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ -# Contribute to Azure Provisioning Agent +# Contribute to Azure-Init This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, diff --git a/Cargo.toml b/Cargo.toml index 18221d1..187aef1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "azure-provisioning-agent" -version = "0.1.0" +name = "azure-init" +version = "0.1.1" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -17,6 +17,7 @@ serde_json = "1.0.96" rustfmt = "0.10.0" nix = "0.26.2" libc = "0.2.146" +fmt = "0.1.0" [profile.dev] incremental = true @@ -26,7 +27,7 @@ name = "lib" path = "src/lib.rs" [[bin]] -name = "azure-provisioning-agent" +name = "azure-init" path = "src/main.rs" [[bin]] diff --git a/README.md b/README.md index f385234..acbab56 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ -# Azure Provisioning Agent +# Azure-Init -[![Github CI](https://github.com/Azure/azure-provisioning-agent/actions/workflows/ci.yaml/badge.svg)](https://github.com/Azure/azure-provisioning-agent/actions) +[![Github CI](https://github.com/Azure/azure-init/actions/workflows/ci.yaml/badge.svg)](https://github.com/Azure/azure-init/actions) -A guest agent implementation for provisioning Linux VMs on Azure. +A minimal guest agent implementation for provisioning Linux VMs on Azure. The agent configures Linux guests from provisioning metadata. -Contrary to complex guest configuration and customisation systems like e.g. cloud-init, the Azure provisioning agent aims to be minimal. +Contrary to complex guest configuration and customisation systems like e.g. cloud-init, Azure-Init aims to be minimal. It strictly focuses on basic instance initialisation from Azure metadata. -The Azure provisioning agent has very few requirements on its environment, so it may run in a very early stage of the boot process. +Azure-Init has very few requirements on its environment, so it may run in a very early stage of the boot process. ## Installing Rust @@ -20,14 +20,14 @@ use of Cargo, which is Rust's compiler and dependency manager. More on the usage ## Pulling Source Code This source code can accessed by cloning the repository to your machine with the command: -`git clone git@github.com:Azure/azure-provisioning-agent.git` +`git clone git@github.com:Azure/azure-init.git` ## Building the Project Building this project can be done by going to the base of the repository in the command line and entering the command `cargo build --all`. This project contains two binaries, the main provisioning agent and the functional testing binary, so this command builds both. These binaries are quite small, but you can build only one by entering -`cargo build --bin ` and indicating either `azure-provisioning-agent` or `functional_tests`. +`cargo build --bin ` and indicating either `azure-init` or `functional_tests`. To run the program, you must enter the command `cargo run --bin ` and indicating the correct binary. diff --git a/SUPPORT.md b/SUPPORT.md index be4787e..ef03337 100644 --- a/SUPPORT.md +++ b/SUPPORT.md @@ -1,18 +1,18 @@ -# Support - -This is a community project. -There are no commercial support options available at this time. - -## How to file issues and get help - -This project uses GitHub Issues to track bugs and feature requests. -Please [search the existing issues](https://github.com/Azure/azure-provisioning-agent/issues) before filing new issues to avoid duplicates. -For new issues, file your bug or feature request as a new issue. - - -For more general help and questions about using this project please [search our discussions](https://github.com/Azure/azure-provisioning-agent/discussions). -Feel free to [start a new discussion](https://github.com/Azure/azure-provisioning-agent/discussions/new/choose) if your topic has not been brought up. - -## Microsoft Support Policy - -Support for the Azure Provisioning Agent is limited to the resources listed above. +# Support + +This is a community project. +There are no commercial support options available at this time. + +## How to file issues and get help + +This project uses GitHub Issues to track bugs and feature requests. +Please [search the existing issues](https://github.com/Azure/azure-init/issues) before filing new issues to avoid duplicates. +For new issues, file your bug or feature request as a new issue. + + +For more general help and questions about using this project please [search our discussions](https://github.com/Azure/azure-init/discussions). +Feel free to [start a new discussion](https://github.com/Azure/azure-init/discussions/new/choose) if your topic has not been brought up. + +## Microsoft Support Policy + +Support for the Azure-Init is limited to the resources listed above. diff --git a/config/azure-provisioning-agent.service b/config/azure-provisioning-agent.service index afb77b8..c4d99c2 100644 --- a/config/azure-provisioning-agent.service +++ b/config/azure-provisioning-agent.service @@ -1,12 +1,12 @@ [Unit] -Description=Azure Provisioning Agent +Description=Azure-Init After=network-online.target Wants=network-online.target -ConditionFileIsExecutable=/var/lib/azure-provisioning-agent/azure-provisioning-agent +ConditionFileIsExecutable=/var/lib/azure-init/azure-init [Service] Type=oneshot -ExecStart=/var/lib/azure-provisioning-agent/azure-provisioning-agent +ExecStart=/var/lib/azure-init/azure-init StandardOutput=journal+console StandardError=journal+console diff --git a/demo/customdata_template.yml b/demo/customdata_template.yml index 4058618..f8cccbe 100644 --- a/demo/customdata_template.yml +++ b/demo/customdata_template.yml @@ -16,10 +16,10 @@ write_files: state=$(systemctl is-system-running || true) sleep 1 done - wget -O /run/azure-provisioning-agent.tgz __SASURL__ - tar -xf /run/azure-provisioning-agent.tgz -C /var/lib - mv /var/lib/azure-provisioning-agent/azure-provisioning-agent.service /lib/systemd/system/azure-provisioning-agent.service - systemctl enable /lib/systemd/system/azure-provisioning-agent.service + wget -O /run/azure-init.tgz __SASURL__ + tar -xf /run/azure-init.tgz -C /var/lib + mv /var/lib/azure-init/azure-init.service /lib/systemd/system/azure-init.service + systemctl enable /lib/systemd/system/azure-init.service cat > /etc/netplan/eth0.yaml < Result> { let client = Client::new(); let mut headers = HeaderMap::new(); - headers.insert( - "x-ms-agent-name", - HeaderValue::from_static("azure-provisioning-agent"), - ); + headers.insert("x-ms-agent-name", HeaderValue::from_static("azure-init")); headers.insert("x-ms-version", HeaderValue::from_static("2012-11-30")); let request = client.get(url).headers(headers); @@ -74,10 +71,7 @@ pub async fn report_health( let client = Client::new(); let mut headers = HeaderMap::new(); - headers.insert( - "x-ms-agent-name", - HeaderValue::from_static("azure-provisioning-agent"), - ); + headers.insert("x-ms-agent-name", HeaderValue::from_static("azure-init")); headers.insert("x-ms-version", HeaderValue::from_static("2012-11-30")); headers.insert( "Content-Type", diff --git a/src/media.rs b/src/media.rs index 45a4f42..a7bebfc 100644 --- a/src/media.rs +++ b/src/media.rs @@ -71,14 +71,14 @@ pub fn mount_media() { .arg("-o") .arg("ro") .arg("/dev/sr0") - .arg("/run/azure-provisioning-agent/tmp/") + .arg("/run/azure-init/tmp/") .status() .expect("Failed to execute mount command."); } pub fn remove_media() { let _unmount_media = Command::new("umount") - .arg("/run/azure-provisioning-agent/tmp/") + .arg("/run/azure-init/tmp/") .status() .expect("Failed to execute unmount command."); @@ -89,7 +89,7 @@ pub fn remove_media() { } pub fn make_temp_directory() -> Result<(), Box> { - let file_path = "/run/azure-provisioning-agent/tmp/"; + let file_path = "/run/azure-init/tmp/"; create_dir_all(file_path)?; @@ -103,7 +103,7 @@ pub fn make_temp_directory() -> Result<(), Box> { } pub fn read_ovf_env_to_string() -> Result> { - let file_path = "/run/azure-provisioning-agent/tmp/ovf-env.xml"; + let file_path = "/run/azure-init/tmp/ovf-env.xml"; let mut file = File::open(file_path).expect("Failed to open file"); let mut contents = String::new(); file.read_to_string(&mut contents) @@ -131,7 +131,7 @@ pub fn parse_ovf_env( pub fn allow_password_authentication() -> Result<(), Box> { - let file_path = "/etc/ssh/sshd_config.d/40-azure-provisioning-agent.conf"; + let file_path = "/etc/ssh/sshd_config.d/40-azure-init.conf"; let password_authentication = "PasswordAuthentication yes"; let mut file =