Skip to content

fix: rio CLI reads ETCD_ENDPOINT and connect to it - #562

Open
rrkumarshikhar wants to merge 1 commit into
develfrom
fix/nightly-etcd-fix
Open

fix: rio CLI reads ETCD_ENDPOINT and connect to it#562
rrkumarshikhar wants to merge 1 commit into
develfrom
fix/nightly-etcd-fix

Conversation

@rrkumarshikhar

Copy link
Copy Markdown
Contributor

No description provided.

@github-actions

Copy link
Copy Markdown

🤖 Pull Request Artifacts (#30090577655) 🎉

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the configtree etcd import helper to derive the etcd endpoint from the environment and to accept more flexible endpoint formats, aligning the CLI’s etcd connectivity behavior with external configuration (e.g., environment variables).

Changes:

  • Add ETCD_ENDPOINT fallback when no explicit endpoint is provided.
  • Add endpoint normalization for comma-separated endpoint lists.
  • Introduce basic host[:port] parsing to derive host/port for Etcd3Client.
Comments suppressed due to low confidence (1)

riocli/configtree/etcd.py:56

  • import_in_etcd only parses endpoint when port is None. If the caller passes a non-None port (e.g., the CLI option default 2379) and the endpoint is provided as host:port, the host passed to Etcd3Client still contains the :port suffix (leading to malformed URLs like host:1234:2379). Consider always stripping any :port suffix from endpoint, and only using the parsed port when the caller didn't explicitly override it.
    # Parse endpoint if port is not separately provided
    if port is None:
        endpoint, port = _parse_etcd_endpoint(endpoint)

    cli = Etcd3Client(host=endpoint, port=port)

Comment thread riocli/configtree/etcd.py
Comment on lines +29 to +35
if ':' in endpoint_str:
host, port_str = endpoint_str.rsplit(':', 1)
try:
return host, int(port_str)
except ValueError:
return endpoint_str, 2379
return endpoint_str, 2379
Comment thread riocli/configtree/etcd.py
Comment on lines +44 to +46
# Use environment variable if endpoint not provided
if endpoint is None:
endpoint = os.getenv("ETCD_ENDPOINT", "localhost")
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