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

Fix Post Install Script Issues #739

Merged
merged 13 commits into from
Aug 6, 2024
Merged

Conversation

spencerugbo
Copy link
Contributor

@spencerugbo spencerugbo commented Jul 9, 2024

Proposed changes

This PR aims to prevent silent fails when agent is installed in a Debian docker image. PostInstall.sh no longer uses the ps command to detect nginx users.

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING document
  • I have run make install-tools and have attached any dependency changes to this pull request
  • If applicable, I have added tests that prove my fix is effective or that my feature works
  • If applicable, I have checked that any relevant tests pass after adding my changes
  • If applicable, I have updated any relevant documentation (README.md)
  • If applicable, I have tested my cross-platform changes on Ubuntu 22, Redhat 8, SUSE 15 and FreeBSD 13

@spencerugbo spencerugbo self-assigned this Jul 9, 2024
@github-actions github-actions bot added the bug Something isn't working label Jul 9, 2024
@@ -39,7 +40,18 @@ detect_nginx_users() {

if [ -z "${nginx_user}" ]; then
printf "PostInstall: Reading NGINX process information to determine NGINX user\n"
nginx_user=$(ps aux | grep "nginx: master process" | grep -v grep | head -1 | awk '{print $1}')
nginx_pid=""
for pid in $(ls /proc | grep -E '^[0-9]+$'); do
Copy link
Contributor

Choose a reason for hiding this comment

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

Remember to install the Shellcheck extension for VS Code: https://marketplace.visualstudio.com/items?itemName=timonwong.shellcheck

My Shellcheck is complaining about this ls command, here's the error it refers to: https://www.shellcheck.net/wiki/SC2010

@github-actions github-actions bot added chore Pull requests for routine tasks dependencies documentation Improvements or additions to documentation labels Jul 11, 2024
@dhurley
Copy link
Collaborator

dhurley commented Jul 16, 2024

@spencerugbo Looks like you need to merge the main into your branch.
Also I noticed that some integration tests are failing. Think its related to the changes you made.

@spencerugbo spencerugbo force-pushed the fix-post-install-script-issues branch from 1538290 to e5bd519 Compare July 18, 2024 10:37
@@ -141,7 +168,7 @@ create_run_dir() {

update_unit_file() {
# Fill in data to unit file that's acquired post install
if command -V systemctl >/dev/null 2>&1; then
if command -v systemctl && [ "$(cat /proc/1/comm)" == "systemd" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably should keep the uppercase -V.

@@ -20,7 +21,7 @@ WORKER_USER=""
AGENT_GROUP="nginx-agent"

detect_nginx_users() {
if command -V systemctl >/dev/null 2>&1; then
if command -v systemctl && [ "$(cat /proc/1/comm)" == "systemd" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably should keep the uppercase -V.

Suggested change
if command -v systemctl && [ "$(cat /proc/1/comm)" == "systemd" ]; then
if command -V systemctl && [ "$(cat /proc/1/comm)" == "systemd" ]; then

Unless there was a reason for the change?

@dhurley dhurley merged commit 594da08 into main Aug 6, 2024
28 checks passed
@dhurley dhurley deleted the fix-post-install-script-issues branch August 6, 2024 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working chore Pull requests for routine tasks dependencies documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants