Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

AmbiguousEnvVar when setting default runner.env with both lower and uppercase

Đang mở
#932 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
42/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
cli

Hướng nghiên cứu

Reproduce the failure using invoke.yml and tasks.py, or the Python configuration shown, then run the @invoke.task function through ctx.run('env && exit 1'). Trace the environment handling involved in RUN_ENV_NO_PROXY and verify that configuring both uppercase and lowercase variants no longer raises AmbiguousEnvVar while preserving the configured values.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Hi,

I think I discovered an issue with the environment system, you can't set default environment variables with both upper and lowercase variants, like for HTTP_PROXY:

import invoke

ns = invoke.Collection()
ns.configure(dict(
    run=dict(
        echo=True,
        env={
            **{
                env_name: "http://my-proxy/"
                for env_name in ("http_proxy", "https_proxy", "HTTP_PROXY", "HTTPS_PROXY")
            },
            **{
                env_name: "localhost" for env_name in ("no_proxy", "NO_PROXY")
            }
        }
    )
))

@invoke.task
def test(ctx):
    ctx.run('env && exit 1')

ns.add_task(test, "test")

This is also true with the following:

invoke.yml

run:
  env:
    HTTP_PROXY: 1
    http_proxy: 1

tasks.py

import invoke

@invoke.task
def test(ctx):
    ctx.run('env && exit 1')
inv test
[..]
invoke.exceptions.AmbiguousEnvVar: Found >1 source for RUN_ENV_NO_PROXY

I guess only keys with the invoke prefix or only external (not set in config) environment variables should be analyzed? RUN_ENV_ subkeys should be analyzed without case modification?

Ngôn ngữ chính
Python
Star
4.8k
Fork
412
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của pyinvoke/invoke

Tất cả issue của pyinvoke/invoke

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.