Skip to content

Commit ac8d721

Browse files
committed
fix capture_shell script
1 parent 61c79fb commit ac8d721

2 files changed

Lines changed: 38 additions & 16 deletions

File tree

rust/operator-binary/src/container.rs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -744,21 +744,19 @@ impl ContainerConfig {
744744
}
745745
args.push_str(&formatdoc!(
746746
r###"
747-
echo "Attempt to format ZooKeeper..."
747+
echo "Attempt to format ZooKeeper ZNode for $POD_NAME ..."
748748
if [[ "0" -eq "$(echo $POD_NAME | sed -e 's/.*-//')" ]] ; then
749-
exclude_from_capture {hadoop_home}/bin/hdfs zkfc -formatZK -nonInteractive
750-
EXITCODE=$?
749+
EXITCODE=$(exclude_from_capture {hadoop_home}/bin/hdfs zkfc -formatZK -nonInteractive)
751750
if [[ $EXITCODE -eq 0 ]]; then
752-
echo "Successfully formatted"
751+
echo "Successfully formatted ZooKeeper ZNode."
753752
elif [[ $EXITCODE -eq 2 ]]; then
754-
echo "ZNode already existed, did nothing"
753+
echo "ZNode already exists, nothing to do."
755754
else
756-
echo "Zookeeper format failed with exit code $EXITCODE"
755+
echo "ZooKeeper format ZNode failed with exit code $EXITCODE".
757756
exit $EXITCODE
758757
fi
759-
760758
else
761-
echo "ZooKeeper already formatted!"
759+
echo "ZooKeeper ZNode already formatted!"
762760
fi
763761
"###,
764762
hadoop_home = Self::HADOOP_HOME,
@@ -1598,15 +1596,10 @@ fn bash_capture_shell_helper(container_name: &str) -> String {
15981596
exclude_from_capture() {{
15991597
# Temporarily restore original FDs just for the duration of this command
16001598
# We use 'local' for the exit code to keep things clean
1601-
set +e
16021599
"$@" 1>&3 2>&4
16031600
local exit_code=$?
1604-
set -e
16051601
1606-
# If the command failed, we manually trigger the exit since we set +e
1607-
if [ $exit_code -ne 0 ]; then
1608-
exit $exit_code
1609-
fi
1602+
echo $exit_code
16101603
}}
16111604
16121605
start_capture

tests/templates/kuttl/logging/hdfs-vector-aggregator-values.yaml.j2

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,20 @@ customConfig:
123123
.pod == "test-hdfs-automatic-log-namenode-default-0" &&
124124
.container == "format-zookeeper" &&
125125
.file == "container.stderr.log"
126+
filteredAutomaticLogConfigNameNode1FormatZookeeperStdout:
127+
type: filter
128+
inputs: [validEvents]
129+
condition: >-
130+
.pod == "test-hdfs-automatic-log-namenode-default-1" &&
131+
.container == "format-zookeeper" &&
132+
.file == "container.stdout.log"
133+
filteredAutomaticLogConfigNameNode1FormatZookeeperStderr:
134+
type: filter
135+
inputs: [validEvents]
136+
condition: >-
137+
.pod == "test-hdfs-automatic-log-namenode-default-1" &&
138+
.container == "format-zookeeper" &&
139+
.file == "container.stderr.log"
126140
filteredAutomaticLogConfigDataNode0:
127141
type: filter
128142
inputs: [validEvents]
@@ -135,12 +149,27 @@ customConfig:
135149
condition: >-
136150
.pod == "test-hdfs-automatic-log-datanode-default-0" &&
137151
.container == "vector"
138-
filteredAutomaticLogConfigDataNode0WaitForNameNodes:
152+
filteredAutomaticLogConfigDataNode0WaitForNameNodesLog4j:
139153
type: filter
140154
inputs: [validEvents]
141155
condition: >-
142156
.pod == "test-hdfs-automatic-log-datanode-default-0" &&
143-
.container == "wait-for-namenodes"
157+
.container == "wait-for-namenodes" &&
158+
.file == "wait-for-namenodes.log4j.xml"
159+
filteredAutomaticLogConfigDataNode0WaitForNameNodesStdout:
160+
type: filter
161+
inputs: [validEvents]
162+
condition: >-
163+
.pod == "test-hdfs-automatic-log-datanode-default-0" &&
164+
.container == "wait-for-namenodes" &&
165+
.file == "container.stdout.log"
166+
filteredAutomaticLogConfigDataNode0WaitForNameNodesStderr:
167+
type: filter
168+
inputs: [validEvents]
169+
condition: >-
170+
.pod == "test-hdfs-automatic-log-datanode-default-0" &&
171+
.container == "wait-for-namenodes" &&
172+
.file == "container.stderr.log"
144173
filteredAutomaticLogConfigJournalNode0:
145174
type: filter
146175
inputs: [validEvents]

0 commit comments

Comments
 (0)