- Community Home
- >
- Software
- >
- HPE Morpheus Software
- >
- HPE Morpheus Enterprise
- >
- Python task output to an input to shell task
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
 
					
				
		
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2023 11:16 PM
08-17-2023 11:16 PM
			
				
					
						
							Python task output to an input to shell task
						
					
					
				
			
		
	
			
	
	
	
	
	
How to pass python task output to an input to shell task
Python task name is PR_US
I created below variable in shell script to store result of PR_US
target_host = morpheus[‘results’][‘PR_US’]
 
					
				
		
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2023 11:30 PM
08-17-2023 11:30 PM
			
				
					
						
							Re: Python task output to an input to shell task
						
					
					
				
			
		
	
			
	
	
	
	
	
Hi Paul,
Please find the doc link Task Results — Morpheus Docs documentation
Please find the video explanation for the above.
https://www.youtube.com/watch?v=UiVp2BTYwU4
python Source Task with code sourceTask
import socket
def get_hostname():
    return socket.gethostname()
if __name__ == "__main__":
    hostname = get_hostname()
    print("Hostname:", hostname)
shell Result task
echo "single: <%=results.sourceTask%>"
if you have added the 2 tasks in an operational workflow and executed the workflow you can see the source task returns “Hostname: xyz” and the Result task returns “single: Hostname: xyz”
Thanks
Velan