Merge ~mertkirpici/charm-juju-lint:lp/1987359 into charm-juju-lint:master-subordinate

Proposed by Mert Kirpici
Status: Merged
Approved by: Erhan Sunar
Approved revision: 91d238f00baa7a31b6380cc5024964b2eba6e5ab
Merged at revision: 91d238f00baa7a31b6380cc5024964b2eba6e5ab
Proposed branch: ~mertkirpici/charm-juju-lint:lp/1987359
Merge into: charm-juju-lint:master-subordinate
Diff against target: 49 lines (+15/-3)
2 files modified
config.yaml (+3/-1)
lib/lib_jujulint.py (+12/-2)
Reviewer Review Type Date Requested Status
🤖 prod-jenkaas-bootstack continuous-integration Approve
Gabriel Cocenza Approve
Erhan Sunar (community) Approve
BootStack Reviewers Pending
Review via email: mp+436610@code.staging.launchpad.net

Commit message

LP #1987359

Description of the change

lib: supply proxy info to auto_lint.py

juju-lint snap supports fetching the rules files via a url now. We need to accomodate for environments with restricted network requirements and pass the network proxy information from the charm environment to the auto_lint.py script via a file in the filesystem.

Also update the charm config to reflect the new behavior.

To post a comment you must log in.
Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Approve (continuous-integration)
Revision history for this message
Erhan Sunar (esunar) wrote :

Overall LGTM. I've just add an inline note.

review: Approve
Revision history for this message
Martin Kalcok (martin-kalcok) wrote :

Just one in-line question from my side. Otherwise LGTM

Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Approve (continuous-integration)
Revision history for this message
Gabriel Cocenza (gabrielcocenza) wrote :

LGTM

review: Approve
Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Approve (continuous-integration)
Revision history for this message
Mert Kirpici (mertkirpici) wrote :

> Just one in-line question from my side. Otherwise LGTM

Updated the implementation after your commend in favor of getting rid of the non-standard proxy.json file as a means to communicate proxy settings between processes.

I would like to explain the current mechanism.

The juju-lint snap is run by the wrapper script /usr/local/bin/auto_lint.py, which is installed via the juju-lint charm. During the lifecycle of the juju-lint charm, there are two different ways/context that this auto_lint.py script is run and we need to adjust the proxy settings for both of them separately:

1 - the script is run directly by the charm code in hook context: during install and config-changed handlers, the charm manually runs the script. see lib_libjuju.JujuLintHelper.run_auto_lint(). we handle the proxy by getting it from the hook environment, and injecting into the subprocess environment variables.

2 - the script is run via crond: the charm installs a cron file at /etc/cron.d/juju-lint, that runs the juju-lint script periodically(see config option "lint-frequency"). it is important to note that this code is _not_ running in any hook context. With the new implementation, the proxy variables are written to the /etc/cron.d/juju-lint file during charm installation/config-changed, which then propagate to auto_lint.py, which further propagates into the juju-lint process.

So currently we are supporting the "standard" way of detecting http{,s} proxies: through environment variables without needing any non-standard way of doing inter process communication, namely a custom file like proxy.json.

There was an error fetching revisions from git servers. Please try again in a few minutes. If the problem persists, contact Launchpad support.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to all changes: