Skip to content

Commit 3f9f9fb

Browse files
author
Marc Schöchlin
committed
Add facility to ask passwords
- add documentation Signed-off-by: Marc Schöchlin <[email protected]>
1 parent 427c7cb commit 3f9f9fb

File tree

2 files changed

+48
-23
lines changed

2 files changed

+48
-23
lines changed

README.md

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,50 +26,70 @@ basis for later automation.
2626
# Usage
2727

2828
```
29-
$ ./openstack_workload_generator --help
30-
usage: Create workloads on openstack installations [-h] [--log_level loglevel] [--os_cloud OS_CLOUD]
31-
[--ansible_inventory [ANSIBLE_INVENTORY]]
32-
[--clouds_yaml [CLOUDS_YAML]] [--wait_for_machines]
33-
[--generate_clouds_yaml [GENERATE_CLOUDS_YAML]]
34-
[--config CONFIG]
35-
(--create_domains DOMAINNAME [DOMAINNAME ...] |
36-
--delete_domains DOMAINNAME [DOMAINNAME ...])
37-
[--create_projects PROJECTNAME [PROJECTNAME ...] |
38-
--delete_projects PROJECTNAME [PROJECTNAME ...]]
39-
[--create_machines SERVERNAME [SERVERNAME ...] |
40-
--delete_machines SERVERNAME [SERVERNAME ...]]
29+
$ openstack_workload_generator --help
30+
usage: Create workloads on openstack installations [-h] [--log_level loglevel] [--os_cloud OS_CLOUD] [--ansible_inventory [ANSIBLE_INVENTORY]]
31+
[--clouds_yaml [CLOUDS_YAML]] [--wait_for_machines] [--generate_clouds_yaml [GENERATE_CLOUDS_YAML]]
32+
[--config CONFIG] (--create_domains DOMAINNAME [DOMAINNAME ...] | --delete_domains DOMAINNAME [DOMAINNAME ...])
33+
[--create_projects PROJECTNAME [PROJECTNAME ...] | --delete_projects PROJECTNAME [PROJECTNAME ...]]
34+
[--create_machines SERVERNAME [SERVERNAME ...] | --delete_machines SERVERNAME [SERVERNAME ...]]
4135
4236
options:
4337
-h, --help show this help message and exit
4438
--log_level loglevel The loglevel
45-
--os_cloud OS_CLOUD The openstack config to use, defaults to the value of the OS_CLOUD environment variable or
46-
"admin" if the variable is not set
39+
--os_cloud OS_CLOUD The openstack config to use, defaults to the value of the OS_CLOUD environment variable or "admin" if the variable is not set
4740
--ansible_inventory [ANSIBLE_INVENTORY]
48-
Dump the created servers as an ansible inventory to the specified directory, adds a ssh
49-
proxy jump for the hosts without a floating ip
41+
Dump the created servers as an ansible inventory to the specified directory, adds a ssh proxy jump for the hosts without a floating ip
5042
--clouds_yaml [CLOUDS_YAML]
5143
Use a specific clouds.yaml file
52-
--wait_for_machines Wait for every machine to be created (normally the provisioning only waits for machines
53-
which use floating ips)
44+
--wait_for_machines Wait for every machine to be created (normally the provisioning only waits for machines which use floating ips)
5445
--generate_clouds_yaml [GENERATE_CLOUDS_YAML]
5546
Generate a openstack clouds.yaml file
56-
--config CONFIG The config file for environment creation, define a path to the yaml file or a subpath in
57-
the profiles folder
47+
--config CONFIG The config file for environment creation, define a path to the yaml file or a subpath in the profiles folder of the tool (you can overload
48+
the search path by setting the OPENSTACK_WORKLOAD_MANAGER_PROFILES environment variable)
5849
--create_domains DOMAINNAME [DOMAINNAME ...]
5950
A list of domains to be created
6051
--delete_domains DOMAINNAME [DOMAINNAME ...]
6152
A list of domains to be deleted, all child elements are recursively deleted
6253
--create_projects PROJECTNAME [PROJECTNAME ...]
6354
A list of projects to be created in the created domains
6455
--delete_projects PROJECTNAME [PROJECTNAME ...]
65-
A list of projects to be deleted in the created domains, all child elements are
66-
recursively deleted
56+
A list of projects to be deleted in the created domains, all child elements are recursively deleted
6757
--create_machines SERVERNAME [SERVERNAME ...]
6858
A list of vms to be created in the created domains
6959
--delete_machines SERVERNAME [SERVERNAME ...]
7060
A list of vms to be deleted in the created projects
7161
```
7262

63+
# Configuration
64+
65+
The following cnfigurations:
66+
67+
* `admin_domain_password`
68+
* the password for the domain users which are created (User `<domain-name>_admin`)
69+
* If you add "ASK_PASSWORD" as a value, the password will be asked in an interactive way
70+
* `admin_vm_password`:
71+
* the password for the operating system user (the username depends on the type of image you are using)
72+
* If you add "ASK_PASSWORD" as a value, the password will be asked in an interactive way
73+
* `vm_flavor`:
74+
* the name of the flavor used to create virtual machines
75+
* see `openstack flavor list`
76+
* `vm_image`:
77+
* the name of the image used to create virtual machines
78+
* see `openstack image list`
79+
* `vm_volume_size_gb`:
80+
* the size of the persistent root volume
81+
* `project_ipv4_subnet`:
82+
* the network cidr of the internal network
83+
* `*_quotas`:
84+
* the quotas for the created projects
85+
* execute the tool with `--log_level DEBUG` to see the configurable values
86+
* `public_network`:
87+
* The name of the public network which is used for floating ips
88+
* `admin_vm_ssh_key`:
89+
* A multiline string which ssh public keys
90+
91+
```
92+
7393
# Testing Scenarios
7494
7595
## Example usage: A minimal scenario

src/openstack_workload_generator/entities/helpers.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import getpass
12
import inspect
23
import logging
34
import os
@@ -140,7 +141,9 @@ def get_number_of_floating_ips_per_project() -> int:
140141

141142
@staticmethod
142143
def get_admin_vm_password() -> str:
143-
return Config.get("admin_vm_password")
144+
if Config.get("admin_vm_password").upper() == "ASK_PASSWORD":
145+
Config._config["admin_vm_password"] = getpass.getpass("Enter the wanted admin_vm_password: ")
146+
return Config.get("admin_vm_password", regex=r".{5,}")
144147

145148
@staticmethod
146149
def get_vm_flavor() -> str:
@@ -176,6 +179,8 @@ def get_admin_vm_ssh_key() -> str:
176179

177180
@staticmethod
178181
def get_admin_domain_password() -> str:
182+
if Config.get("admin_domain_password").upper() == "ASK_PASSWORD":
183+
Config._config["admin_domain_password"] = getpass.getpass("Enter the wanted admin_domain_password: ")
179184
return Config.get("admin_domain_password", regex=r".{5,}")
180185

181186
@staticmethod

0 commit comments

Comments
 (0)