Skip to content

Commit

Permalink
Azure-Init: rename to azure-init (#41)
Browse files Browse the repository at this point in the history
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 <thilofromm@microsoft.com>
  • Loading branch information
t-lo committed Feb 27, 2024
1 parent d19b788 commit 02ade86
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 62 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -26,7 +27,7 @@ name = "lib"
path = "src/lib.rs"

[[bin]]
name = "azure-provisioning-agent"
name = "azure-init"
path = "src/main.rs"

[[bin]]
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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 <binary_name>` and indicating either `azure-provisioning-agent` or `functional_tests`.
`cargo build --bin <binary_name>` and indicating either `azure-init` or `functional_tests`.

To run the program, you must enter the command `cargo run --bin <binary_name>` and indicating the correct binary.

Expand Down
36 changes: 18 additions & 18 deletions SUPPORT.md
Original file line number Diff line number Diff line change
@@ -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.
6 changes: 3 additions & 3 deletions config/azure-provisioning-agent.service
Original file line number Diff line number Diff line change
@@ -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

Expand Down
8 changes: 4 additions & 4 deletions demo/customdata_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<EOF
network:
ethernets:
Expand Down
20 changes: 10 additions & 10 deletions demo/image_creation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -e -u -x -o pipefail

epoch=$(date +%s)
temp_dir=/tmp/staging.$epoch
target_dir=azure-provisioning-agent
target_dir=azure-init
staging_dir=$temp_dir/$target_dir
echo "*********************************************************************"
echo "Building the agent"
Expand All @@ -19,29 +19,29 @@ echo "*********************************************************************"
echo "Staging artifacts to $staging_dir"
echo "*********************************************************************"
mkdir -p $staging_dir
cp $root_dir/target/debug/azure-provisioning-agent $staging_dir/
cp $root_dir/config/azure-provisioning-agent.service $staging_dir/
cp $root_dir/target/debug/azure-init $staging_dir/
cp $root_dir/config/azure-init.service $staging_dir/
cp $root_dir/demo/customdata_template.yml $temp_dir/customdata.yml
echo "Done"

echo "*********************************************************************"
echo "Creating azure-provisioning-agent.tgz package for upload"
echo "Creating azure-init.tgz package for upload"
echo "*********************************************************************"
rm -f ./azure-provisioning-agent.tgz
tar cvfz azure-provisioning-agent.tgz -C $temp_dir $target_dir
rm -f ./azure-init.tgz
tar cvfz azure-init.tgz -C $temp_dir $target_dir
echo "Done"

echo "*********************************************************************"
echo "Uploading package as azure-provisioning-agent-$epoch.tgz"
echo "Uploading package as azure-init-$epoch.tgz"
echo "*********************************************************************"
az storage blob upload --account-name aztuxprovisioningtest -c minagent --file azure-provisioning-agent.tgz --name azure-provisioning-agent-$epoch.tgz
az storage blob upload --account-name aztuxprovisioningtest -c minagent --file azure-init.tgz --name azure-init-$epoch.tgz
echo "Done"

echo "*********************************************************************"
echo "Generating a SAS for azure-provisioning-agent-$epoch.tgz"
echo "Generating a SAS for azure-init-$epoch.tgz"
echo "*********************************************************************"
end=$(date -u -d '10 days' '+%Y-%m-%dT%H:%MZ')
sasurl=$(az storage blob generate-sas --account-name aztuxprovisioningtest -c minagent -n azure-provisioning-agent-$epoch.tgz --permissions r --expiry $end --https-only --full-uri)
sasurl=$(az storage blob generate-sas --account-name aztuxprovisioningtest -c minagent -n azure-init-$epoch.tgz --permissions r --expiry $end --https-only --full-uri)
echo "Done"

echo "*********************************************************************"
Expand Down
10 changes: 2 additions & 8 deletions src/goalstate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ pub async fn get_goalstate() -> Result<Goalstate, Box<dyn std::error::Error>> {
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);
Expand All @@ -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",
Expand Down
10 changes: 5 additions & 5 deletions src/media.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.");

Expand All @@ -89,7 +89,7 @@ pub fn remove_media() {
}

pub fn make_temp_directory() -> Result<(), Box<dyn std::error::Error>> {
let file_path = "/run/azure-provisioning-agent/tmp/";
let file_path = "/run/azure-init/tmp/";

create_dir_all(file_path)?;

Expand All @@ -103,7 +103,7 @@ pub fn make_temp_directory() -> Result<(), Box<dyn std::error::Error>> {
}

pub fn read_ovf_env_to_string() -> Result<String, Box<dyn std::error::Error>> {
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)
Expand Down Expand Up @@ -131,7 +131,7 @@ pub fn parse_ovf_env(

pub fn allow_password_authentication() -> Result<(), Box<dyn std::error::Error>>
{
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 =
Expand Down

0 comments on commit 02ade86

Please sign in to comment.