Skip to content

configure.py: retyping a configured services host still drops the others, and a comma-separated ADMIN_HOSTMASKS is read as characters #911

Description

@chchatzop

Follow-up to #891 / #909 (merged). #909 fixed the reported case - pressing Enter at the services-host prompt no longer collapses several hosts to the first. Two cases in the same step still lose or misread hosts; both were covered by #903, which #909 superseded.

1. Retyping a host that is already configured replaces all the others

With ADMIN_HOSTMASKS = ["*!*@me.users.undernet.org", "*!*@my-phone.example.net"], re-running configure.py and typing me.users.undernet.org - the operator's own host, out of habit, or because the prompt no longer shows it as the default - writes ["*!*@me.users.undernet.org"]. The phone loses admin to the console and the channel commands. The "This replaces the 2 services hosts already configured with just this one" line is printed after the host is typed, with no way back. That is the loss #891 was about, reached by typing instead of by Enter.

Fix: a host already configured (case-insensitively) changes nothing. Whether a new host beside several replaces them or is added is a choice; one question cannot know which of several it replaces, so adding and saying how to remove one is the safe default.

2. A comma-separated ADMIN_HOSTMASKS is read as characters

adminchat.admin_host_patterns() accepts ADMIN_HOSTMASKS as a string ("*!*@a,*!*@b", which admin_config.py can hold). The prompt indexes it directly: current_hostmasks[0] is "*", and len(current_hostmasks) counts characters - "This replaces the 13 services hosts...".

Fix: read the hosts the way the console does - admin_host_patterns(): either form, deduplicated, host part only - and show them (Configured now: ...) so the operator can see what a typed answer would change.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions