Skip to content

Please add a timeout for requests.get() calls #609

@xavpaice

Description

@xavpaice

Checklist

  • Confirmed this is an issue with charm-tools, not charmstore-client
  • Provide versions of tools used
  • Described the feature or ways to replicate the issue

What version am I running?

I ran the following command: snap info charm and got the following output:

name:      charm
summary:   charm and charm-tools
publisher: Canonical✓
store-url: https://snapcraft.io/charm
contact:   https://discourse.juju.is/c/charming
license:   unset
description: |
  charmstore-client and charm-tools
commands:
  - charm
snap-id:      2Rryoc2ylScfbFl4eQtpntHD9iuZuMvt
tracking:     latest/stable
refresh-date: 2021-02-02
channels:
  latest/stable:    2.8.2               2021-02-01 (609) 119MB classic
  latest/candidate: 2.8.2               2021-02-01 (609) 119MB classic
  latest/beta:      2.8.2               2021-02-01 (609) 119MB classic
  latest/edge:      2.8.3+git-1-736b1ad 2021-02-23 (620) 119MB classic
installed:          2.8.2                          (609) 119MB classic

I am using: Ubuntu 21.04

Issue/Feature

I expect/expected the following

When network issues prevent access to the charm layer index, I expect to see a timeout and an error message explaining what was wrong.

What I got

If I do not set appropriate environment variables (for proxy):

build: Unable to locate layer:apt. Do you need to set CHARM_LAYERS_DIR?

If I set the HTTP_PROXY, HTTPS_PROXY, and NO_PROXY variables, instead of that message the build (with debug enabled) hangs at:

charmtools.build.fetchers: Checking layer index: https://juju.github.io/layer-index/layers/apt.json

Regardless of the difficulties with network access, it would be good if the build step could add a timeout and more clear exception handling at

result = requests.get(uri)
as that would aid charm developers trying to fix their build environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions