Skip to content

Commit

Permalink
Fix deb/rpm integTest not install distribution correctly
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>
  • Loading branch information
peterzhuamazon committed Jan 26, 2024
1 parent bb767ab commit 64439f7
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ RUN dnf install -y sudo && \
usermod -a -G opensearch $CONTAINER_USER && \
usermod -a -G opensearch-dashboards $CONTAINER_USER && \
id && \
echo "$CONTAINER_USER ALL=(root) NOPASSWD:`which systemctl`, `which dnf`, `which yum`, `which rpm`, `which chmod`, `which kill`, `which curl`, /usr/share/opensearch-dashboards/bin/opensearch-dashboards-plugin" >> /etc/sudoers.d/$CONTAINER_USER
echo "$CONTAINER_USER ALL=(root) NOPASSWD:`which systemctl`, `which env`, `which dnf`, `which yum`, `which rpm`, `which chmod`, `which kill`, `which curl`, /usr/share/opensearch-dashboards/bin/opensearch-dashboards-plugin" >> /etc/sudoers.d/$CONTAINER_USER

# Copy from Stage0
COPY --from=linux_stage_0 --chown=$CONTAINER_USER:$CONTAINER_USER $CONTAINER_USER_HOME $CONTAINER_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ RUN apt-get install -y sudo && \
usermod -a -G opensearch $CONTAINER_USER && \
usermod -a -G opensearch-dashboards $CONTAINER_USER && \
id && \
echo "$CONTAINER_USER ALL=(root) NOPASSWD:`which systemctl`, `which apt`, `which apt-get`, `which apt-key`, `which dpkg`, `which chmod`, `which kill`, `which curl`, `which tee`, /usr/share/opensearch-dashboards/bin/opensearch-dashboards-plugin" >> /etc/sudoers.d/$CONTAINER_USER
echo "$CONTAINER_USER ALL=(root) NOPASSWD:`which systemctl`, `which env`, `which apt`, `which apt-get`, `which apt-key`, `which dpkg`, `which chmod`, `which kill`, `which curl`, `which tee`, /usr/share/opensearch-dashboards/bin/opensearch-dashboards-plugin" >> /etc/sudoers.d/$CONTAINER_USER

# Copy from Stage0
COPY --from=linux_stage_0 --chown=$CONTAINER_USER:$CONTAINER_USER $CONTAINER_USER_HOME $CONTAINER_USER_HOME
Expand Down
6 changes: 2 additions & 4 deletions src/test_workflow/integ_test/distribution_deb.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,14 @@ def install(self, bundle_name: str) -> None:
logging.info("deb installation requires sudo, script will exit if current user does not have sudo access")
deb_install_cmd = " ".join(
[
'sudo',
'env',
'OPENSEARCH_INITIAL_ADMIN_PASSWORD=myStrongPassword123!',
'&&',
'sudo',
'dpkg',
'--purge',
self.filename,
'&&',
'sudo',
'env',
'OPENSEARCH_INITIAL_ADMIN_PASSWORD=myStrongPassword123!',
'dpkg',
'--install',
bundle_name,
Expand Down
6 changes: 2 additions & 4 deletions src/test_workflow/integ_test/distribution_rpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,15 @@ def install(self, bundle_name: str) -> None:
logging.info("rpm installation requires sudo, script will exit if current user does not have sudo access")
rpm_install_cmd = " ".join(
[
'sudo',
'env',
'OPENSEARCH_INITIAL_ADMIN_PASSWORD=myStrongPassword123!',
'&&',
'sudo',
'yum',
'remove',
'-y',
self.filename,
'&&',
'sudo',
'env',
'OPENSEARCH_INITIAL_ADMIN_PASSWORD=myStrongPassword123!',
'yum',
'install',
'-y',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def custom_node_endpoint_encoder(node_endpoint: NodeEndpoint) -> dict:
if os.path.exists(script):
if len(cluster_endpoints) == 1:
single_data_node = cluster_endpoints[0].data_nodes[0]
cmd = f"bash {script} -b {single_data_node.endpoint} -p {single_data_node.port} -s {str(security).lower()} -v {self.bundle_manifest.build.version}"
cmd = f"bash {script} -b {single_data_node.endpoint} -p {single_data_node.port} -s {str(security).lower()} -v {self.bundle_manifest.build.version} | tee /tmp/123"
else:
endpoints_list = []
for cluster_details in cluster_endpoints:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def custom_node_endpoint_encoder(node_endpoint: NodeEndpoint) -> dict:
return {"endpoint": node_endpoint.endpoint, "port": node_endpoint.port, "transport": node_endpoint.transport}
if os.path.exists(script):
single_node = cluster_endpoints[0].data_nodes[0]
cmd = f"bash {script} -b {single_node.endpoint} -p {single_node.port} -s {str(security).lower()} -t {self.component.name} -v {self.bundle_manifest.build.version} -o default"
cmd = f"bash {script} -b {single_node.endpoint} -p {single_node.port} -s {str(security).lower()} -t {self.component.name} -v {self.bundle_manifest.build.version} -o default | tee /tmp/123"
self.repo_work_dir = os.path.join(
self.repo.dir, self.test_config.working_directory) if self.test_config.working_directory is not None else self.repo.dir
(status, stdout, stderr) = execute(cmd, self.repo_work_dir, True, False)
Expand Down

0 comments on commit 64439f7

Please sign in to comment.