hyphen in hostname causes error
- Dominant language
- Python
- Stars
- 8
- Forks
- 172
- Avg merge
- 14h 51m
- Merged PRs (30d)
- 180
Description
**Describe the bug**
If Omnia is given a host name with a hyphen `ansible-playbook prepare_oim` task fails.
**To Reproduce**
Steps to reproduce the behavior:
1. During configuration or by editing: `/opt/omnia/.data/oim_metadata.yml`...
2. ... set a hostname with a hypen in it.
3. run `ansible-playbook ./prepare_oim.yml`
4. See error:
```
TASK [deploy_containers/openchami : Check ochami bss status] ******************************************************************
skipping: [oim]
TASK [deploy_containers/openchami : Display bss status] ***********************************************************************
skipping: [oim]
TASK [deploy_containers/openchami : Verify ochami dependencies] ***************************************************************
fatal: [oim]: FAILED! => {"changed": false, "module_stderr": "Shared connection to localhost closed.\r\n", "module_stdout": "bash: TEST-OIM_ACCESS_TOKEN=aabbccddeeff....
```
**Expected behavior**
No error.
**Additional context**
Occasionally Omnia builds environment variables using the ansible variable `oim_node_name`. oim_node_name is in-turn set to `$(hostname)`. If hostname has a hyphen, an environment variable is created and named that includes a hyphen. Hyphens are not supported in environment variables in most common shells:
https://github.com/dell/omnia/blob/main/common/vars/openchami_vars.yml#L16
Contributor guide
Research direction
Start with common/vars/openchami_vars.yml at the referenced line and trace how oim_node_name is used while running prepare_oim.yml. Reproduce the failure with a hostname containing a hyphen using ansible-playbook ./prepare_oim.yml. Done means the playbook completes without creating an invalid shell environment variable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ansible
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 70/100