added hostname setting
This commit is contained in:
parent
04b7cc9836
commit
d25f7aeec3
2 changed files with 11 additions and 3 deletions
|
|
@ -1,6 +1,6 @@
|
|||
[project]
|
||||
name = "swagspace_cloud_init"
|
||||
version = "0.3.0"
|
||||
version = "0.4.0"
|
||||
description = ""
|
||||
authors = [
|
||||
{name = "Johannes Erwerle",email = "jo@swagspace.org"}
|
||||
|
|
|
|||
|
|
@ -198,6 +198,7 @@ def build_vm():
|
|||
default_interface_name=primary_interface,
|
||||
)
|
||||
user_data = build_user_data(
|
||||
hostname=args.vm_name,
|
||||
username=args.username,
|
||||
password=password,
|
||||
target_dir=cloud_init_tempdir_path,
|
||||
|
|
@ -293,7 +294,9 @@ def get_ssh_keys(username: str) -> List[str]:
|
|||
return keys
|
||||
|
||||
|
||||
def build_user_data(username: str, password: str, target_dir: Path) -> Path:
|
||||
def build_user_data(
|
||||
hostname: str, username: str, password: str, target_dir: Path
|
||||
) -> Path:
|
||||
"""
|
||||
Builds the user-data file in *target_dir* and returns a Path to it.
|
||||
"""
|
||||
|
|
@ -316,7 +319,12 @@ def build_user_data(username: str, password: str, target_dir: Path) -> Path:
|
|||
|
||||
keyboard = {"layout": "de", "model": "pc105"}
|
||||
|
||||
user_data = {"users": users, "power_state": power_state, "keyboard": keyboard}
|
||||
user_data = {
|
||||
"users": users,
|
||||
"power_state": power_state,
|
||||
"keyboard": keyboard,
|
||||
"hostname": hostname,
|
||||
}
|
||||
|
||||
target_path = target_dir / "user-data"
|
||||
with target_path.open("w+") as f:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue