Changes include:
1. Adding post customization function.
2. Removed Installation of post custom scripts.
3. Set post GC status (Started / Successful / Failure)
Change-Id: Ie8f029ad128c6ecbe812ec70258bdb44ae12e34b
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/5318
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Sharath George
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,110 @@ |
| 0 |
+diff -Naur gosc-scripts/imc-shell/imgcust-scripts/CustomizationUtils.sh gosc-scripts-modify/imc-shell/imgcust-scripts/CustomizationUtils.sh |
|
| 1 |
+--- gosc-scripts/imc-shell/imgcust-scripts/CustomizationUtils.sh 2016-04-30 04:11:27.000000000 +0530 |
|
| 2 |
+@@ -633,6 +633,55 @@ |
|
| 3 |
+ Info "RunCustomScript has completed" |
|
| 4 |
+ } |
|
| 5 |
+ |
|
| 6 |
++# Runs post-customization script. |
|
| 7 |
++# |
|
| 8 |
++# Args: |
|
| 9 |
++# scriptPath: string: relative path to the script |
|
| 10 |
++# Results: |
|
| 11 |
++# None |
|
| 12 |
++# Throws: |
|
| 13 |
++# Dies in case execution returns non-zero exit code. |
|
| 14 |
++RunPostCustomScript() |
|
| 15 |
++{
|
|
| 16 |
++ local scriptPath=$1 |
|
| 17 |
++ |
|
| 18 |
++ Info "RunPostCustomScript invoked" |
|
| 19 |
++ |
|
| 20 |
++ if [[ -e $scriptPath ]]; then |
|
| 21 |
++ # Strip any CR characters from the decoded script |
|
| 22 |
++ Exec "${CAT} $scriptPath | ${TR} -d '\r' > $scriptPath.tmp" '' ''
|
|
| 23 |
++ Exec "${CHMOD} u+x $scriptPath.tmp" '' ''
|
|
| 24 |
++ |
|
| 25 |
++ Info "Executing post-customization script..." |
|
| 26 |
++ |
|
| 27 |
++ ${SH} -c "$scriptPath.tmp postcustomization"
|
|
| 28 |
++ local exitCode=$? |
|
| 29 |
++ if [[ $exitCode -ne 0 ]]; then |
|
| 30 |
++ Die "Execution of post-customization failed!" |
|
| 31 |
++ fi |
|
| 32 |
++ else |
|
| 33 |
++ Warn "Customization script '$scriptPath' does not exist" |
|
| 34 |
++ fi |
|
| 35 |
++ |
|
| 36 |
++ Info "RunPostCustomScript has completed" |
|
| 37 |
++} |
|
| 38 |
++ |
|
| 39 |
++# Sets Guest Customization status |
|
| 40 |
++# |
|
| 41 |
++# Args: |
|
| 42 |
++# Status: String: Started / Successful / Failed |
|
| 43 |
++# Results: |
|
| 44 |
++# None |
|
| 45 |
++# Throws: |
|
| 46 |
++# None |
|
| 47 |
++PostGCStatus() |
|
| 48 |
++{
|
|
| 49 |
++ local STATUS=$1 |
|
| 50 |
++ local OUTPUT="$(ps -C vmtoolsd -o cmd=)" |
|
| 51 |
++ local CMD="$OUTPUT --cmd \"info-set guestinfo.gc.status $STATUS\"" |
|
| 52 |
++ eval $CMD |
|
| 53 |
++} |
|
| 54 |
++ |
|
| 55 |
+ # Installs post-customization script. |
|
| 56 |
+ # |
|
| 57 |
+ # Args: |
|
| 58 |
+diff -Naur gosc-scripts/imc-shell/imgcust-scripts/PhotonCustomization.sh gosc-scripts-modify/imc-shell/imgcust-scripts/PhotonCustomization.sh |
|
| 59 |
+--- gosc-scripts/imc-shell/imgcust-scripts/PhotonCustomization.sh 2016-04-30 02:40:39.000000000 +0530 |
|
| 60 |
+@@ -20,7 +20,6 @@ |
|
| 61 |
+ scriptName=`${DIRNAME} $configPath`"/$scriptName"
|
|
| 62 |
+ Info "Handling customization script [$scriptName]" |
|
| 63 |
+ RunCustomScript $scriptName |
|
| 64 |
+- InstallCustomScript $scriptName |
|
| 65 |
+ else |
|
| 66 |
+ Info "No customization script to run" |
|
| 67 |
+ fi |
|
| 68 |
+@@ -88,7 +87,27 @@ |
|
| 69 |
+ |
|
| 70 |
+ Info "Photon customization started" |
|
| 71 |
+ |
|
| 72 |
++ #Set Guest Customization status as Started |
|
| 73 |
++ PostGCStatus "Started" |
|
| 74 |
++ |
|
| 75 |
+ RunCloudConfig $configFilePath |
|
| 76 |
+ |
|
| 77 |
+ Info "Photon customization finished" |
|
| 78 |
++ |
|
| 79 |
++ # Run Post customization script |
|
| 80 |
++ |
|
| 81 |
++ local scriptName=$(ConfigFile_GetCustomScriptName) |
|
| 82 |
++ |
|
| 83 |
++ if [[ -n "$scriptName" ]]; then |
|
| 84 |
++ scriptName=`${DIRNAME} $configFilePath`"/$scriptName"
|
|
| 85 |
++ Info "Handling Post Customization script [$scriptName]" |
|
| 86 |
++ RunPostCustomScript $scriptName |
|
| 87 |
++ else |
|
| 88 |
++ Info "No post customization script to run" |
|
| 89 |
++ fi |
|
| 90 |
++ |
|
| 91 |
++ #Set Guest customization status as successful |
|
| 92 |
++ PostGCStatus "Successful" |
|
| 93 |
++ |
|
| 94 |
++ Info "Photon Customization Successful. GC Status is updated" |
|
| 95 |
+ } |
|
| 96 |
+diff -Naur gosc-scripts/imc-shell/imgcust-scripts/Utils.sh gosc-scripts-modify/imc-shell/imgcust-scripts/Utils.sh |
|
| 97 |
+--- gosc-scripts/imc-shell/imgcust-scripts/Utils.sh 2016-04-30 02:40:39.000000000 +0530 |
|
| 98 |
+@@ -105,6 +105,8 @@ |
|
| 99 |
+ {
|
|
| 100 |
+ Error "$@" |
|
| 101 |
+ echo "DIE: $@" 1>&2 |
|
| 102 |
++ # Set Guest customization status as failure |
|
| 103 |
++ PostGCStatus "Failed" |
|
| 104 |
+ exit 1 |
|
| 105 |
+ } |
|
| 106 |
+ |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
Summary: Usermode tools for VmWare virts |
| 2 | 2 |
Name: open-vm-tools |
| 3 | 3 |
Version: 10.2.0 |
| 4 |
-Release: 3%{?dist}
|
|
| 4 |
+Release: 4%{?dist}
|
|
| 5 | 5 |
License: LGPLv2+ |
| 6 | 6 |
URL: https://github.com/vmware/open-vm-tools |
| 7 | 7 |
Group: Applications/System |
| ... | ... |
@@ -18,6 +18,7 @@ Patch1: hostnameReCustomizationFix.patch |
| 18 | 18 |
Patch2: PureIPv6-hosts.patch |
| 19 | 19 |
Patch3: GOSC-libDeploy.patch |
| 20 | 20 |
Patch4: timezoneCust.patch |
| 21 |
+Patch5: gosc-post-custom.patch |
|
| 21 | 22 |
BuildRequires: glib-devel |
| 22 | 23 |
BuildRequires: xerces-c-devel |
| 23 | 24 |
BuildRequires: xml-security-c-devel |
| ... | ... |
@@ -54,6 +55,7 @@ It contains the libraries and header files to create applications. |
| 54 | 54 |
%patch2 -p0 |
| 55 | 55 |
%patch3 -p2 |
| 56 | 56 |
%patch4 -p0 |
| 57 |
+%patch5 -p0 |
|
| 57 | 58 |
%build |
| 58 | 59 |
touch ChangeLog |
| 59 | 60 |
autoreconf -i |
| ... | ... |
@@ -113,6 +115,8 @@ fi |
| 113 | 113 |
%{_libdir}/*.so
|
| 114 | 114 |
|
| 115 | 115 |
%changelog |
| 116 |
+* Fri Jun 22 2018 Keerthana K <keerthanak@vmware.com> 10.2.0-4 |
|
| 117 |
+- Fix for post custom script failure. |
|
| 116 | 118 |
* Mon Apr 09 2018 Srivatsa S. Bhat <srivatsa@csail.mit.edu> 10.2.0-3 |
| 117 | 119 |
- Revert regex changes to gosc scripts. |
| 118 | 120 |
* Wed Mar 21 2018 Anish Swaminathan <anishs@vmware.com> 10.2.0-2 |