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

Set cmd_env for trusty and xenial only #573

Merged
merged 3 commits into from
Mar 8, 2021
Merged

Conversation

murraybd
Copy link
Contributor

Only set the command environment for the supported releases which require it.

Only set the command environment for the supported releases which require it.
@murraybd
Copy link
Contributor Author

murraybd commented Feb 19, 2021

I was installing the cassandra charm on bionic with the following set in /etc/apt/apt.conf.d/95-juju-proxy-settings:

Acquire::http::Proxy "http://squid.internal:3128";
Acquire::https::Proxy "http://squid.internal:3128";

This was failing with the following Traceback:

2021-02-18 23:27:33 INFO juju-log Failed executing 'add-apt-repository --yes ppa:cassandra-charmers/stable'. Will retry in 10 seconds
2021-02-18 23:27:44 ERROR juju-log Hook error:
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-cassandra-0/.venv/lib/python3.6/site-packages/charms/reactive/__init__.py", line 73, in main
    hookenv._run_atstart()
  File "/var/lib/juju/agents/unit-cassandra-0/.venv/lib/python3.6/site-packages/charmhelpers/core/hookenv.py", line 1312, in _run_atstart
    callback(*args, **kwargs)
  File "/var/lib/juju/agents/unit-cassandra-0/charm/reactive/apt.py", line 117, in configure_sources
    keys_var='install_keys')
  File "/var/lib/juju/agents/unit-cassandra-0/.venv/lib/python3.6/site-packages/charmhelpers/fetch/__init__.py", line 148, in configure_sources
    add_source(source, key)
  File "/var/lib/juju/agents/unit-cassandra-0/.venv/lib/python3.6/site-packages/charmhelpers/fetch/ubuntu.py", line 600, in add_source
    fn(*m.groups())
  File "/var/lib/juju/agents/unit-cassandra-0/.venv/lib/python3.6/site-packages/charmhelpers/fetch/ubuntu.py", line 641, in _add_apt_repository
    cmd_env=env_proxy_settings(['https']))
  File "/var/lib/juju/agents/unit-cassandra-0/.venv/lib/python3.6/site-packages/charmhelpers/fetch/ubuntu.py", line 748, in _run_with_retries
    result = subprocess.check_call(cmd, env=env)
  File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['add-apt-repository', '--yes', 'ppa:cassandra-charmers/stable']' returned non-zero exit status 1.

My change resolved the Traceback I encountered and the install was able to complete.

Copy link
Contributor

@thedac thedac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. Given the git history this returns the behavior to pre commit 0f198e4 and still handles < bionic.

@thedac thedac merged commit 29c9c2c into juju:master Mar 8, 2021
coreycb pushed a commit to coreycb/charm-helpers that referenced this pull request May 4, 2021
coreycb pushed a commit to coreycb/charm-helpers that referenced this pull request May 10, 2021
This reverts commit 29c9c2c.

This change also removes the comment regarding software-properties
as it was adding confusion. add-apt-repository is provided by the
software-properties package. While http_proxy and https_proxy env
vars appear to work with add-apt-repository, apt.conf settings
Acquire::http::Proxy and Acquire::https::Proxy do not appear to
work with add-apt-repository.

Fixes juju#602
wolsen added a commit that referenced this pull request May 12, 2021
Revert "Set cmd_env for trusty and xenial only (#573)"
coreycb pushed a commit to coreycb/charm-helpers that referenced this pull request May 13, 2021
This reverts commit 29c9c2c.

This change also removes the comment regarding software-properties
as it was adding confusion. add-apt-repository is provided by the
software-properties package. While http_proxy and https_proxy env
vars appear to work with add-apt-repository, apt.conf settings
Acquire::http::Proxy and Acquire::https::Proxy do not appear to
work with add-apt-repository.

Fixes juju#602

(cherry picked from commit ba4dae4)
coreycb pushed a commit to coreycb/charm-helpers that referenced this pull request May 13, 2021
This reverts commit 29c9c2c.

This change also removes the comment regarding software-properties
as it was adding confusion. add-apt-repository is provided by the
software-properties package. While http_proxy and https_proxy env
vars appear to work with add-apt-repository, apt.conf settings
Acquire::http::Proxy and Acquire::https::Proxy do not appear to
work with add-apt-repository.

Fixes juju#602

(cherry picked from commit ba4dae4)
lourot added a commit that referenced this pull request Jul 2, 2021
Revert "Set cmd_env for trusty and xenial only (#573)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants