VMware Cloud Community
Uday_Mantri
Enthusiast
Enthusiast
Jump to solution

Bash Script Example for Guest Script Manager vRO - Unable to use any variable defined in the script

Hello Team,

Require help in running a bash script on to a RHEL Server using Guest Script Manager Package.

Problem is that the package runs only the direct commands on the target RHEL Server and ignores any defined variable in the script.

Unable to use any variable defined in the script.

Example1

If we run the below via the Guest Script Manager Package. It does not return any output

Declared script as below and got blank result

Uday_Mantri_0-1674549359137.png

Output1

Uday_Mantri_1-1674549393398.png

While running the above script directly on a Linux Server gives the desired output.

Example2

Similarly if we remove the variable, and print it directly it works fine.

Uday_Mantri_2-1674549486769.png

Output2

Uday_Mantri_3-1674549556239.png

 

Reply
0 Kudos
1 Solution

Accepted Solutions
cgaya
Contributor
Contributor
Jump to solution

I actually ran into this same issue today.  I was able to solve it by creating another resource element holding my actual script content and telling the script config to use that file via the "Copy a file in the guest" tickbox in the "Add script configuration vRO 8.x" or "Edit script configuration vRO 8.x" workflows.

Then in the script content for the script config, put something similar to the following...

chmod 0777 ./linuxBootstrap.sh
./linuxBootstrap.sh

Hopefully thats clear.  Here are a couple screenshots:

cgaya_1-1674612149182.png

cgaya_2-1674612157661.png

Also, make sure you use LF and not CRLF in the bash script or you will get other errors.

Edit: Forgot to mention that by default your new script resource element should be at "Resources/COE/Guest resources".  Not sure if that path is configurable or not.

 

 

 

 

 

 

View solution in original post

3 Replies
scott28tt
VMware Employee
VMware Employee
Jump to solution

As your post needs moving to the area for Aria Automation Orchestrator, I have reported it to the volunteer moderators.

 


-------------------------------------------------------------------------------------------------------------------------------------------------------------

Although I am a VMware employee I contribute to VMware Communities voluntarily (ie. not in any official capacity)
VMware Training & Certification blog
Reply
0 Kudos
cgaya
Contributor
Contributor
Jump to solution

I actually ran into this same issue today.  I was able to solve it by creating another resource element holding my actual script content and telling the script config to use that file via the "Copy a file in the guest" tickbox in the "Add script configuration vRO 8.x" or "Edit script configuration vRO 8.x" workflows.

Then in the script content for the script config, put something similar to the following...

chmod 0777 ./linuxBootstrap.sh
./linuxBootstrap.sh

Hopefully thats clear.  Here are a couple screenshots:

cgaya_1-1674612149182.png

cgaya_2-1674612157661.png

Also, make sure you use LF and not CRLF in the bash script or you will get other errors.

Edit: Forgot to mention that by default your new script resource element should be at "Resources/COE/Guest resources".  Not sure if that path is configurable or not.

 

 

 

 

 

 

Uday_Mantri
Enthusiast
Enthusiast
Jump to solution

Thank You for the suggestion and the help.

It worked. 

Tags (1)
Reply
0 Kudos