ppc64le-cloud / pvsadm

Tool for managing the IBM Power Systems Virtual Servers
Apache License 2.0
37 stars 32 forks source link

cleanup not getting executed from template script #624

Closed janagoudarniroop closed 2 months ago

janagoudarniroop commented 3 months ago

What happened: Build Server used: redhat 9-2 sap server using pvsadm tool to build the rhel 8-10 and rhel 9-4 image , even though cleanup is mentioned in template script but its not reflecting in the image

pvsadm image qcow2ova --image-name rhel-9-4 --image-url ./rhel-9.4-ppc64le-kvm.qcow2 --image-dist rhel --image-size 100 --target-disk-size 100 --rhn-user --rhn-password --os-password --temp-dir /rhel_tmp --prep-template template-redhat-9-4-vanilla-2024-q2.sh

cat template-redhat-9-4-vanilla-2024-q2.sh | tail

#passd security
usermod -p '!' root
usermod -L root

# clean up
rm -rf /etc/sysconfig/network-scripts/ifcfg-eth0
rm -rf /tmp/ci_package
rm -rf /setup.sh
rm -rf /root/.ssh
rm -rf /etc/pki/entitlement/
history -c

But this is not getting executed inside the image


[root@test-rhel-9-4-vanilla-t1 ~]# ls -l /etc/sysconfig/network-scripts/ifcfg-eth0
-rw-r--r--. 1 root root 271 Jun  5 01:58 /etc/sysconfig/network-scripts/ifcfg-eth0
[root@test-rhel-9-4-vanilla-t1 ~]# ls -l  /tmp/ci_package
total 248
-rwxr-xr-x. 1 root root 238140 Jun  5 01:10 ibm-power-repo-latest.noarch.rpm
-rwxr-xr-x. 1 root root  11584 Jun  5 01:10 powervs-fls-rhel-0.0.6-1.0.ppc64le.rpm
[root@test-rhel-9-4-vanilla-t1 ~]# ls -l /setup.sh
-rwxr--r--. 1 root root 6212 Jun  5 01:08 /setup.sh
[root@test-rhel-9-4-vanilla-t1 ~]# ls -l /root/.ssh
total 12
-rw-------. 1 root root 596 Jun  5 01:58 authorized_keys
-rw-------. 1 root root 840 Jun  5 01:10 known_hosts
-rw-r--r--. 1 root root  96 Jun  5 01:10 known_hosts.old
[root@test-rhel-9-4-vanilla-t1 ~]# ls -l  /etc/pki/entitlement/
total 0
[root@test-rhel-9-4-vanilla-t1 ~]# 

What you expected to happen:

We expected all the files to be cleared and removed from the image which would be built

How to reproduce it (as minimally and precisely as possible):

Try to build an rhel 9-4 or rhel 8-10 image with these cmds in template script and check if the files are removed from the final image

Anything else we need to know?:

Environment:

KeerthanaAP commented 2 months ago

Closing this issue as this is resolved after changing the order of execution of commands in the template provided, Need to execute cleanup before the passd security steps and it doesn't need any fix in pvsadm template.

KeerthanaAP commented 2 months ago

/close

ppc64le-cloud-bot commented 2 months ago

@KeerthanaAP: Closing this issue.

In response to [this](https://github.com/ppc64le-cloud/pvsadm/issues/624#issuecomment-2175261955): >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.