Skip to content

Commit 0a99b6a

Browse files
committed
Create empty secure.yml in /tmp to ensure secrets.yml takes precedence
When loading credentials from secrets.yml, the OpenStack SDK might still find /etc/openstack/secure.yml with a different password. Creating an empty /tmp/secure.yml ensures the SDK uses the password from secrets.yml. AI-assisted: Claude Code Signed-off-by: Christian Berendt <berendt@osism.tech>
1 parent 52eec77 commit 0a99b6a

4 files changed

Lines changed: 7 additions & 4 deletions

File tree

osism/commands/loadbalancer.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
from tabulate import tabulate
1111
import yaml
1212

13-
import openstack
14-
1513
from osism.commands.octavia import wait_for_amphora_boot
1614
from osism.tasks.openstack import (
1715
cleanup_cloud_environment,

osism/commands/server.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from cliff.command import Command
77
import dateutil
88
from loguru import logger
9-
import openstack
109
from prompt_toolkit import prompt
1110
from tabulate import tabulate
1211

osism/commands/volume.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from cliff.command import Command
77
import dateutil
88
from loguru import logger
9-
import openstack
109
from prompt_toolkit import prompt
1110
import pytz
1211
from tabulate import tabulate

osism/tasks/openstack.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,13 @@ def setup_cloud_environment(cloud):
377377
yaml.dump(clouds_config, f)
378378
temp_files_to_cleanup.append(dst_clouds)
379379

380+
# Create an empty secure.yml in /tmp to prevent SDK from reading
381+
# /etc/openstack/secure.yml which might have a different (wrong) password
382+
dst_secure = "/tmp/secure.yml"
383+
with open(dst_secure, "w") as f:
384+
yaml.dump({}, f)
385+
temp_files_to_cleanup.append(dst_secure)
386+
380387
# Change working directory to /tmp so subprocesses find the config
381388
os.chdir("/tmp")
382389

0 commit comments

Comments
 (0)