Skip to content

Commit b0b32d9

Browse files
release 0.6.2 (#38)
* Bugfix/20867 update erchef service to cdomain (#36) * update spec file * add cdomain to webui for scanner, and s3 * update chef config file --------- Co-authored-by: nilsver <139124949+nilsver@users.noreply.github.com>
1 parent 67ef7ab commit b0b32d9

2 files changed

Lines changed: 43 additions & 5 deletions

File tree

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.6.1
1+
0.6.2

packaging/rpm/redborder-proxy.spec

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,24 +51,62 @@ install -D -m 0755 resources/lib/dhclient-enter-hooks %{buildroot}/usr/lib/redbo
5151
if ls /opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/specifications/default/openssl-3.0.1.* 1> /dev/null 2>&1; then
5252
rm -f /opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/specifications/default/openssl-3.0.1.*
5353
fi
54+
MARKER_FILE="/var/lib/redborder/upgrade_etc_hosts_patch_done"
5455
case "$1" in
5556
1)
5657
# This is an initial install.
5758
:
5859
;;
5960
2)
6061
# This is an upgrade.
61-
CDOMAIN_FILE="/etc/redborder/cdomain"
62+
if [ -f "$MARKER_FILE" ]; then
63+
echo "Post-install patch already applied, skipping."
64+
exit 0
65+
fi
6266

67+
CDOMAIN_FILE="/etc/redborder/cdomain"
6368
if [ -f "$CDOMAIN_FILE" ]; then
6469
SUFFIX=$(cat "$CDOMAIN_FILE")
6570
else
6671
SUFFIX="redborder.cluster"
6772
fi
6873

69-
NEW_DOMAIN="http2k.${SUFFIX}"
70-
71-
sed -i -E "s/\bhttp2k\.service\b/${NEW_DOMAIN}/" /etc/hosts
74+
NEW_DOMAIN_HTTP2K="http2k.${SUFFIX}"
75+
NEW_DOMAIN_ERCHEF="erchef.service.${SUFFIX}"
76+
NEW_DOMAIN_WEBUI="webui.${SUFFIX}"
77+
NEW_DOMAIN_S3="s3.service.${SUFFIX}"
78+
79+
grep -qE '\bhttp2k\.service[[:space:]]' /etc/hosts && \
80+
sed -i -E "s/\bhttp2k\.service\b/${NEW_DOMAIN_HTTP2K}/" /etc/hosts
81+
82+
grep -qE '\berchef\.service[[:space:]]' /etc/hosts && \
83+
sed -i -E "s/\berchef\.service\b/${NEW_DOMAIN_ERCHEF}/" /etc/hosts
84+
85+
grep -qE '\bs3\.service[[:space:]]' /etc/hosts && \
86+
sed -i -E "s/\bs3\.service\b/${NEW_DOMAIN_S3}/" /etc/hosts
87+
88+
grep -qE '\bwebui\.service[[:space:]]' /etc/hosts && \
89+
sed -i -E "s/\bwebui\.service\b/${NEW_DOMAIN_WEBUI}/" /etc/hosts
90+
91+
CHEF_FILES=(
92+
"/etc/chef/client.rb.default"
93+
"/etc/chef/client.rb"
94+
"/etc/chef/knife.rb.default"
95+
"/etc/chef/knife.rb"
96+
"/root/.chef/knife.rb"
97+
)
98+
99+
for f in "${CHEF_FILES[@]}"; do
100+
if [ -f "$f" ]; then
101+
if grep -q 'https://erchef\.service/' "$f"; then
102+
sed -i "s|https://erchef\.service/|https://${NEW_DOMAIN_ERCHEF}/|" "$f"
103+
echo "Updated: $f"
104+
fi
105+
fi
106+
done
107+
108+
mkdir -p "/var/lib/redborder"
109+
touch "$MARKER_FILE"
72110
;;
73111
esac
74112

0 commit comments

Comments
 (0)