Bug 1290887
Summary: | RFE: some unit templates should not be suggested by bash completion | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Kostya Vasilyev <kmansoft> |
Component: | systemd | Assignee: | systemd-maint |
Status: | CLOSED NOTABUG | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | medium | Docs Contact: | |
Priority: | unspecified | ||
Version: | 23 | CC: | devrim, hhorak, jmlich83, johannbg, jstanek, lnykryn, msekleta, pkajaba, praiskup, s, systemd-maint, tgl, zbyszek |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | x86_64 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2016-01-04 17:32:51 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Kostya Vasilyev
2015-12-11 19:10:56 UTC
postgresql@ should not appear in autocomplete list. It's a template for unit files but alone does not make much sense. I have switched this from postgresql to systemd Autocompletion proposes all units that *might* be wanted. It's not too smart, and since both postgresql.service and postgresql@.service are present, it proposes both. On my system I see $ systemctl start postgresql<TAB><TAB> postgresql@ postgresql.service The first is without the ending, and you, as the user, are supposed to add the instance name to the template. I don't think there's anything to fix here. I would consider this as RFE. There should be a way how to disable completing postgresql@ because unless you configure explicitly, it is not useful at all. Can you be more specific about the RFE: how should the completion engine "know" that you don't want the template? That is the RFE itself. Lets design some way how could I (via packaging) let you know (systemd/systemd completion) that the template "is"/"is not" useful without additional configuration. Note: It seems that 'service postgres<TAB>' works fine here, only 'postgresql' and 'postgresql@second' is suggested on my system. (In reply to Pavel Raiskup from comment #6) > Note: It seems that 'service postgres<TAB>' works fine here, only > 'postgresql' > and 'postgresql@second' is suggested on my system. This is most likely because systemd already knows about 'postgresql' (it is a dependency of something else), and somehow only that gets proposed. (In reply to Pavel Raiskup from comment #5) > Lets design some way how could I (via packaging) let > you know (systemd/systemd completion) that the template "is"/"is not" useful > without additional configuration. So the shell completion scripts would need to learn a way to query for unit-specific state... It certainly is doable, but I don't think it's worth the trouble. As an analogy, rm -rf /<TAB> also completes various stuff that probably is not relevant most of the time. When there is a *simple* way to make completion smart we try to do that, but making completion scripts too complicated makes them slow and usually misses various corner cases anyway. How would user let systemd/bash-completion know that he changed configuration and postgresql@ became useful? Just don't put postgresql@ by default to %{_unitdir}. Whoever finds out how to configure postgresql in a way that template becomes useful can also copy unit file to proper place from somewhere else. In case you are worried about update scenario, then simply check in post script whether user moved template to %{_unitdir} and if yes then copy it over there on updates. (In reply to Michal Sekletar from comment #8) > How would user let systemd/bash-completion know that he changed > configuration and postgresql@ became useful? Yeah, that's the question. > Just don't put postgresql@ by default to %{_unitdir}. Whoever finds out how > to configure postgresql in a way that template becomes useful can also copy > unit file to proper place from somewhere else. I don't think this is a good idea: it makes everything more complicated and brittle. (In reply to Zbigniew Jędrzejewski-Szmek from comment #9) > (In reply to Michal Sekletar from comment #8) > > How would user let systemd/bash-completion know that he changed > > configuration and postgresql@ became useful? > > Yeah, that's the question. E.g. /etc/systemd/system/postgresql.d/ says that the postgresql is useful. But yes, there is nothing worse than slow completion -- thus I don't object if you plan to close this WONTFIX/NOTABUG. I'm not an OP anyway. (In reply to Pavel Raiskup from comment #10) > (In reply to Zbigniew Jędrzejewski-Szmek from comment #9) > > (In reply to Michal Sekletar from comment #8) > > > How would user let systemd/bash-completion know that he changed > > > configuration and postgresql@ became useful? > > > > Yeah, that's the question. > > E.g. /etc/systemd/system/postgresql.d/ says that the > postgresql is useful. Yes, but then we would need a second layer which would specify that for postgresql@.service per-instance configuration is necessary, but for some other foobar@.service it is not necessary. I'll close this as notabug. |