Project

General

Profile

Actions

Bug #25908

open

Allow passing env vars to package managers

Added by Alexis Mousset about 1 month ago. Updated 21 days ago.

Status:
Pending technical review
Priority:
N/A
Category:
Generic methods
Target version:
Severity:
UX impact:
User visibility:
Effort required:
Priority:
0
Name check:
To do
Fix check:
To do
Regression:
No

Actions #1

Updated by Alexis Mousset about 1 month ago

  • Status changed from New to In progress
  • Assignee set to Alexis Mousset
Actions #2

Updated by Alexis Mousset about 1 month ago · Edited

Tested behavior with:

import os
import unittest
from pprint import pprint

def env(option):
    if option.startswith("env:"):
        env_option = option.split(":", 1)[1]
        env_var = env_option.split("=", 1)
        if len(env_var) == 2:
            return env_var
            # os.environ[env_var[0]] = env_var[1]
        else:
            return None

class TestEnvOption(unittest.TestCase):

    def test_upper(self):
        self.assertEqual(env(""), None)
        self.assertEqual(env("--ignore"), None)
        self.assertEqual(env("env:"), None)
        self.assertEqual(env("env:NAME"), None)
        self.assertEqual(env("env:NAME=VALUE"), ["NAME", "VALUE"])
        # allow unsetting a variable
        self.assertEqual(env("env:NAME="), ["NAME", ""])
        self.assertEqual(env("env:NAME=VALUE=PLOP"), ["NAME", "VALUE=PLOP"])

if __name__ == "__main__":
    unittest.main()
Actions #3

Updated by Alexis Mousset about 1 month ago

  • Status changed from In progress to Pending technical review
  • Assignee changed from Alexis Mousset to Félix DALLIDET
  • Pull Request set to https://github.com/Normation/ncf/pull/1436
Actions #4

Updated by Vincent MEMBRÉ 25 days ago

  • Target version changed from 8.1.9 to 8.1.10
Actions #5

Updated by Vincent MEMBRÉ 21 days ago

  • Target version changed from 8.1.10 to 8.1.11
Actions

Also available in: Atom PDF