CAPEv2 icon indicating copy to clipboard operation
CAPEv2 copied to clipboard

Environment variables in az.conf causing error

Open ChrisThibodeaux opened this issue 1 year ago • 7 comments

About accounts on capesandbox.com

  • Issues isn't the way to ask for account activation. Ping capesandbox in Twitter with your username

This is open source and you are getting free support so be friendly!

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • [x] I am running the latest version
  • [x] I did read the README!
  • [x] I checked the documentation and found no answer
  • [x] I checked to make sure that this issue has not already been filed
  • [x] I'm reporting the issue to the correct repository (for multi-repository projects)
  • [x] I have read and checked all configs (with all optional parts)

Expected Behavior

Placing an env variable as such to work: subscription_id = %(ENV:SUBSCRIPTION_ID)s

Current Behavior

Errors out with a configparser.InterpolationMissingOptionError

Failure Information (for bugs)

configparser.InterpolationMissingOptionError: Bad value substitution: option 'subscription_id' in section 'az' contains an interpolation key 'env:subscription_id' which is not a valid option name. Raw value: '%(ENV:SUBSCRIPTION_ID)s'

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. Place env variable in the manner specified in the docs.

Context

Deploying in Azure while following the docs.

Question Answer
Git commit Type $ git log | head -n1 to find out
OS version Ubuntu 16.04, Windows 10, macOS 10.12.3

Failure Logs

Please include any relevant log snippets or files here.

ChrisThibodeaux avatar Jun 24 '24 20:06 ChrisThibodeaux

cape@hostname:~$ python3 --version Python 3.10.12 cape@hostname:~$ env | grep "SUBSCRIPTION_ID" SUBSCRIPTION_ID=<redacted value>

The environment variable exists and is correctly set.

To view spots where the error occurs, run journalctl -u for either cape.service, cape-web.service, or cape-processor.service.

ChrisThibodeaux avatar Jun 24 '24 21:06 ChrisThibodeaux

az worker is community based, so you need to wait till community who has AZ fixes it or you can check how to fix it

doomedraven avatar Jun 25 '24 18:06 doomedraven

@doomedraven Thank you for the reply. I will be looking into potential fixes until someone with more knowledge comes along.

ChrisThibodeaux avatar Jun 25 '24 22:06 ChrisThibodeaux

I have entered a python shell in /opt/CAPEv2 as cape user on the host machine and followed the code flow as it would execute in a running system. Oddly, it works perfectly fine. Not sure what the real issue is here.

Found a work-around until a fix is in place. I used replace, similar to the linux command sed, in my ansible to place in the Azure subscription_id, client_id, secret, and tenant. I keep those values in my ansible vault. If you are using anisble and pushing this to a repo, be sure to use no_log: true somewhere in the task.

ChrisThibodeaux avatar Jun 28 '24 15:06 ChrisThibodeaux

@cccs-mog

cccs-kevin avatar Sep 11 '24 19:09 cccs-kevin

Hi @ChrisThibodeaux, can you confirm if this is something only happening for this environment variable (namely subscription_id) you did face this for others as well ? Also could you give the full trace for the error in question ?

cccs-mog avatar Sep 11 '24 20:09 cccs-mog

@cccs-mog I will try that for each env var In az.conf and report back. I'll also include the fullest trace I can for the issue.

ChrisThibodeaux avatar Sep 13 '24 14:09 ChrisThibodeaux