Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shellcheck : Fix hooks/ #2017

Open
wants to merge 12 commits into
base: dev
Choose a base branch
from
Open

Shellcheck : Fix hooks/ #2017

wants to merge 12 commits into from

Conversation

Salamandar
Copy link
Contributor

No description provided.

@Salamandar Salamandar force-pushed the shellcheck branch 2 times, most recently from d1fd9f5 to 3730780 Compare December 21, 2024 20:38
Copy link
Member

@zamentur zamentur left a comment

Choose a reason for hiding this comment

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

nginx error on adding domain shoudl be fixed before merging

set -Eeuo pipefail

# Source YNH helpers
# shellcheck source=../../helpers/helpers
Copy link
Member

Choose a reason for hiding this comment

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

o_O

Copy link
Member

Choose a reason for hiding this comment

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

I don't understand if it's really needed to add shellcheck source=../../helpers/helpers

slapcat -b dc=yunohost,dc=org -l "${backup_dir}/dc=yunohost-dc=org.ldif"
echo "$backup_dir" > "$tmp_backup_dir_file"
if [ -e /etc/ldap/slapd.conf ]; then
curr_backend=$(grep '^database' /etc/ldap/slapd.conf | awk '{print $2}')
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason to remove the 2> /dev/null ?

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
curr_backend=$(grep '^database' /etc/ldap/slapd.conf | awk '{print $2}')
curr_backend=$(grep '^database' /etc/ldap/slapd.conf 2> /dev/null | awk '{print $2}')

echo "$backup_dir" > "$tmp_backup_dir_file"
if [ -e /etc/ldap/slapd.conf ]; then
curr_backend=$(grep '^database' /etc/ldap/slapd.conf | awk '{print $2}')
if [ "$curr_backend" != 'mdb' ]; then
Copy link
Member

Choose a reason for hiding this comment

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

What if $curr_backend is empty string "" ? Are you sure it secure to remove [ -n "$curr_backend" ]

Suggested change
if [ "$curr_backend" != 'mdb' ]; then
if [ "$curr_backend" != 'mdb' ] && [ -n "$curr_backend" ]; then

@@ -18,9 +18,12 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

# Exit hook on subcommand error or unset variable
set -e
Copy link
Member

Choose a reason for hiding this comment

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

Test seems to fail for regenconf nginx, so may be that's why we keep only set -e ?

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

Successfully merging this pull request may close these issues.

2 participants