Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Environment variables manager : Value not set properly when create user environment variable with URL value #290

Closed
1 task done
imallet opened this issue Jul 4, 2023 · 3 comments · Fixed by #291
Assignees
Labels
bug Something isn't working jobs Scenarios and jobs

Comments

@imallet
Copy link

imallet commented Jul 4, 2023

Is there an existing issue or a documentation page for this?

  • I have searched the existing issues and within documentation

Which version of the app are you using?

0.24.0

Operating System

Windows 10+*

Packaging mode

Stand-alone executable (.i.e qdt.exe)

Related resources

scenario.qdt.zip

user_environment_variables_before

scenario

log

user_environment_variables_after

QGISDeploymentToolbelt_0.24.0.log

Description of the bug

The first step of the scenario file scenario.qdt.yml is to define 2 user environment variables to be added :

steps:
  - name: Set environment variables
    uses: manage-env-vars
    with:
      - name: HTTP_PROXY
        action: "add"
        value: "http://proxyhttppronoauth.grandlyon.fr:8080"
        scope: "user"
      - name: HTTPS_PROXY
        action: "add"
        value: "http://proxyhttppronoauth.grandlyon.fr:8080"
        scope: "user"

The scenario runs successfully, the 2 user environment variables are indeed created but their values are not correct :

HTTP_PROXY=C:\Users\sitimal\http\proxyhttppronoauth.grandlyon.fr:8080
HTTPS_PROXY=C:\Users\sitimal\http\proxyhttppronoauth.grandlyon.fr:8080

Values should be :

HTTP_PROXY=http://proxyhttppronoauth.grandlyon.fr:8080
HTTPS_PROXY=http://proxyhttppronoauth.grandlyon.fr:8080

Steps to reproduce

  1. Open command line terminal
  2. Run the following command :
    QGISDeploymentToolbelt_0-24-0_Windows64bit_Python3-11 deploy -s C:\Installations\Sources\QDT\scenario.qdt.yml -vv

Relevant log output

2023-07-04 17:27:57||INFO||journalizer||118||Log file: C:\Users\sitimal\.cache\qgis-deployment-toolbelt\logs\QGISDeploymentToolbelt_0.24.0.log
2023-07-04 17:27:57||INFO||journalizer||126||========== QGIS Deployment Toolbelt - 0.24.0 ==========
2023-07-04 17:27:57||DEBUG||journalizer||127||Operating System: Windows-10-10.0.19045-SP0
2023-07-04 17:27:57||DEBUG||journalizer||128||Architecture: 64bit
2023-07-04 17:27:57||DEBUG||journalizer||129||Computer: PC222436
2023-07-04 17:27:57||DEBUG||journalizer||130||Launched by user: sitimal
2023-07-04 17:27:57||DEBUG||journalizer||133||OS Domain: BEN
2023-07-04 17:27:57||DEBUG||proxies||51||No proxy settings found in environment vars nor OS settings.
2023-07-04 17:27:57||DEBUG||journalizer||138||No network proxies detected
2023-07-04 17:27:57||DEBUG||cli||184||Log level set: Level 3
2023-07-04 17:27:57||DEBUG||deployment||118||Running deploy with Namespace(verbosity=3, opt_logfile_disabled=True, command='deploy', scenario_filepath='C:\\Installations\\Sources\\QDT\\scenario.qdt.yml', func=<function run at 0x0000027FECD9CE00>)
2023-07-04 17:27:57||INFO||deployment||164||Running scenario: Scénario de déploiement des profils Grand Lyon pour QGIS. (grand-lyon-profils-qgis-communs). Profils QGIS du Grand Lyon.
2023-07-04 17:27:57||DEBUG||deployment||171||Setting environment variable QDT_DEBUG = True.
2023-07-04 17:27:57||DEBUG||deployment||171||Setting environment variable QDT_LOCAL_WORK_DIR = ~/.cache/qgis-deployment-toolbelt/Grand Lyon/.
2023-07-04 17:27:57||DEBUG||deployment||171||Setting environment variable QDT_QGIS_EXE_PATH = {'linux': '/usr/bin/qgis', 'mac': '/usr/bin/qgis', 'windows': '%PROGRAMFILES%/QGIS 3.32.0/bin/qgis-bin.exe'}.
2023-07-04 17:27:57||DEBUG||deployment||171||Setting environment variable QDT_SCENARIO_VALIDATION = True.
2023-07-04 17:27:57||INFO||deployment||180||QDT working folder: C:\Users\sitimal\.cache\qgis-deployment-toolbelt\Grand Lyon
2023-07-04 17:27:57||DEBUG||orchestrator||66||4 environment variables related to QDT:
2023-07-04 17:27:57||DEBUG||orchestrator||68||QDT_DEBUG=True
2023-07-04 17:27:57||DEBUG||orchestrator||68||QDT_LOCAL_WORK_DIR=~/.cache/qgis-deployment-toolbelt/Grand Lyon/
2023-07-04 17:27:57||DEBUG||orchestrator||68||QDT_QGIS_EXE_PATH={'linux': '/usr/bin/qgis', 'mac': '/usr/bin/qgis', 'windows': '%PROGRAMFILES%/QGIS 3.32.0/bin/qgis-bin.exe'}
2023-07-04 17:27:57||DEBUG||orchestrator||68||QDT_SCENARIO_VALIDATION=True
2023-07-04 17:27:57||INFO||deployment||196||Running step: manage-env-vars
2023-07-04 17:27:57||WARNING||job_environment_variables||133||http://proxyhttppronoauth.grandlyon.fr:8080 seems to be a valid path but does not exist (yet).
2023-07-04 17:27:57||WARNING||job_environment_variables||133||http://proxyhttppronoauth.grandlyon.fr:8080 seems to be a valid path but does not exist (yet).
2023-07-04 17:27:57||DEBUG||job_environment_variables||120||Job manage-env-vars ran successfully.
2023-07-04 17:27:57||INFO||deployment||196||Running step: qprofiles-manager
...

Comment

It looks as though the string "http://" is badly interpreted by QDT and the %USERPROFILE% value (C:\Users\sitimal) is used to prefix it when writing the value of the environment variable.

@imallet imallet added the triage To be qualified, waiting for a project manager label Jul 4, 2023
@NROLLANDGrandlyon
Copy link

In my case, the following statement:

  • name: HTTPS_PROXY
            action: "add"
            value: "http://proxyhttppronoauth.grandlyon.fr:8080/"
            scope: "user"
         
          - name: QDT_LOGS_DIR
            action: "add"
            value: "C:/Installations/Logs"
            scope: "user"  

Leads to the following value
HTTPS_PROXY=C:/Installations/http:/proxyhttppronoauth.grandlyon.fr:8080

Env variable is not visible in Windows's Env variable window nor it is in the registry. Only visible through the SET cmd and impossible to delete. Only possible to force a new correct value in registry HKEY_CURRENT_USER\Environment

@imallet
Copy link
Author

imallet commented Jul 6, 2023

New test with this syntax (escaping '/' characters) :

steps:
  - name: Set environment variables
    uses: manage-env-vars
    with:
      - name: HTTP_PROXY
        action: "add"
        value: "http:\/\/proxyhttppronoauth.grandlyon.fr:8080"
        scope: "user"
      - name: HTTPS_PROXY
        action: "add"
        value: "http:\/\/proxyhttppronoauth.grandlyon.fr:8080"
        scope: "user"

but no improvement in the result :

HTTP_PROXY=C:\Users\sitimal\http\proxyhttppronoauth.grandlyon.fr:8080
HTTPS_PROXY=C:\Users\sitimal\http\proxyhttppronoauth.grandlyon.fr:8080

that should be :

HTTP_PROXY=http://proxyhttppronoauth.grandlyon.fr:8080
HTTPS_PROXY=http://proxyhttppronoauth.grandlyon.fr:8080

@Guts Guts closed this as completed in #291 Jul 11, 2023
Guts added a commit that referenced this issue Jul 11, 2023
…lues (#291)

To avoid ambiguity, it adds an option to the [Environment variables
manager
job](https://guts.github.io/qgis-deployment-cli/jobs/environment_variables.html)
allowing user to specify value type:

```yaml
  - name: Set environment variables
    uses: manage-env-vars
    with:
      - name: HTTP_PROXY
        action: "add"
        scope: "user"
        value: "http://proxy.qdt.fr:8080"
        value_type: url
      - name: HTTPS_PROXY
        action: "add"
        scope: "user"
        value: "https://proxy.qdtfr:443"
        value_type: url
      - name: DISABLE_SSL
        action: "add"
        scope: "user"
        value: False
        value_type: bool
      - name: PYQGIS_STARTUP
        action: "add"
        scope: "user"
        value: "~/qgis/startup.py"
        value_type: path
```

Closes #290
@Guts Guts added bug Something isn't working jobs Scenarios and jobs and removed triage To be qualified, waiting for a project manager labels Jul 11, 2023
@Guts
Copy link
Collaborator

Guts commented Jul 11, 2023

Thanks for reporting.
Fixed in #291

Released in https://github.com/Guts/qgis-deployment-cli/releases/tag/0.26.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working jobs Scenarios and jobs
Projects
None yet
3 participants