Fixed controls in case appropriate configs are missing#6
Open
rbapin wants to merge 1 commit into
Open
Conversation
mastersin
requested changes
Sep 5, 2020
mastersin
left a comment
Member
There was a problem hiding this comment.
Нужно исправить логику проверки на предмет правильного кода ошибки (если нет файла, то unknown для запроса текущего состояния и код ошибки 0, а для запроса на изменение - код ошибки 2).
|
|
||
| case "$*" in | ||
| status|'') | ||
| test -f "$CONFIG" || echo "unknown" && exit 2 |
Member
There was a problem hiding this comment.
Это нерабочая конструкция, см.:
$ true || echo u && echo e
e
$ false || echo u && echo e
u
e|
|
||
| new_summary 'Browse autofs target mountpoints' | ||
|
|
||
| case "$*" in |
Member
There was a problem hiding this comment.
Непонятно - зачем, вообще, нужен этот case?
Если конфигурационный файл отсутствует, то в любом случае на запрос о статусе должен выдаваться unknown без ошибок (код ошибки 0):
Сейчас так:
- когда конфигурационный файл имеется, выход такой:
$ grep ^browse /etc/autofs.conf
browse_mode = no
$ sudo control autofs-browse-mode
disabled
$ echo $?
0
$ grep ^browse /etc/autofs.conf
browse_mode = aaa
$ sudo control autofs-browse-mode
unknown
$ echo $?
0
$ sudo control autofs-browse-mode disabled
$ sudo control autofs-browse-mode
disabled- когда конфигурационный файл отсутствует:
$ sudo mv /etc/autofs.conf /etc/autofs.conf.saved
$ sudo control autofs-browse-mode
grep: /etc/autofs.conf: Нет такого файла или каталога
grep: /etc/autofs.conf: Нет такого файла или каталога
grep: /etc/autofs.conf: Нет такого файла или каталога
unknown
$ echo $?
0
$ sudo control autofs-browse-mode disabled
grep: /etc/autofs.conf: Нет такого файла или каталога
grep: /etc/autofs.conf: Нет такого файла или каталога
grep: /etc/autofs.conf: Нет такого файла или каталога
sed: невозможно выполнить stat для /etc/autofs.conf: Нет такого файла или каталога
$ echo $?
17bdd5a0 to
4859646
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.