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

AOC system user update (#477) #482

Merged
merged 1 commit into from
Jun 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packaging/debian/preinst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ if ! grep "^aoc:" /etc/group >/dev/null 2>&1; then
fi

if ! id aoc >/dev/null 2>&1; then
useradd -r -M aoc -d /home/aoc -g aoc >/dev/null 2>&1
useradd -r -M aoc -d /home/aoc -g aoc -c "AWS OTel Collector" -s $(test -x /sbin/nologin && echo /sbin/nologin || (test -x /usr/sbin/nologin && echo /usr/sbin/nologin || (test -x /bin/false && echo /bin/false || echo /bin/sh))) >/dev/null 2>&1
echo "create user aoc, result: $?"
else
usermod aoc -c "AWS OTel Collector" -s $(test -x /sbin/nologin && echo /sbin/nologin || (test -x /usr/sbin/nologin && echo /usr/sbin/nologin || (test -x /bin/false && echo /bin/false || echo /bin/sh))) >/dev/null 2>&1
echo "update user aoc, result: $?"
fi
7 changes: 5 additions & 2 deletions packaging/linux/amazon-cloudwatch-agent.spec
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,11 @@ if ! grep "^aoc:" /etc/group >/dev/null 2>&1; then
fi

if ! id aoc >/dev/null 2>&1; then
useradd -r -M aoc -d /home/aoc -g aoc >/dev/null 2>&1
echo "create user aoc, result: $?"
useradd -r -M aoc -d /home/aoc -g aoc -c "AWS OTel Collector" -s $(test -x /sbin/nologin && echo /sbin/nologin || (test -x /usr/sbin/nologin && echo /usr/sbin/nologin || (test -x /bin/false && echo /bin/false || echo /bin/sh))) >/dev/null 2>&1
echo "create user aoc, result: $?"
else
usermod aoc -c "AWS OTel Collector" -s $(test -x /sbin/nologin && echo /sbin/nologin || (test -x /usr/sbin/nologin && echo /usr/sbin/nologin || (test -x /bin/false && echo /bin/false || echo /bin/sh))) >/dev/null 2>&1
echo "update user aoc, result: $?"
fi

%preun
Expand Down
5 changes: 4 additions & 1 deletion packaging/windows/amazon-cloudwatch-agent-ctl.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,10 @@ Function CWOCConfig() {
Write-Output "Successfully fetched the config and saved in ${YAML_DIR}\default.tmp"
} else {
& cmd /c "`"$CWAProgramFiles\config-downloader.exe`" --output-dir ${YAML_DIR} --download-source ${OtelConfigLocation} --mode ${param_mode} --config ${COMMON_CONIG} --multi-config ${multi_config} 2>&1"
CheckCMDResult # Exit immediately if config-downloader outputs any error
# Use return instead of exit since CWAgent and ADOT Collector should be two independent agents as much as possible
if ($LASTEXITCODE -ne 0) {
return
}
}

$yamlDirContent = Get-ChildItem "${YAML_DIR}" | Measure-Object
Expand Down