Cadet 2nd Class Cadet 2nd Class
Cadet 2nd Class
828 views

Need to create/push scripts to HPSA via pytwist code from a managed server

Hi All,

I am new to this forum and am looking forward to hear from you on my query.

I have a requirement to push new server scripts to HPSA va pytwist API... i see that the pytwist can be run from a managed server in hpsa .Can any of you help me out with this setup ? 

Similarly i should be able to pull the script information from hpsa via pytwist, add new scripts (to a specific folder), update existing scripts, etc.

0 Likes
9 Replies
Micro Focus Expert
Micro Focus Expert

Hi Venky,

You should look into the methods available in the ServerScriptService interface under opt.opsware.script.

I believe you'll find everything you need in there.

0 Likes
Cadet 2nd Class Cadet 2nd Class
Cadet 2nd Class

Hi Boneimre,

I did have a look at the methods in there ... to create a server script..
but am not quite sure as to how to write it and call the service and how to provide the arguments, attributes, etc... for Create Server script. Thought someone mght have already worked on it and can provide me an example of how it can be done.

- Venky
0 Likes
Micro Focus Expert
Micro Focus Expert

You can find examples of different twist clients here: https://softwaresupport.softwaregrp.com/km/KM00417670

Also there is a whole chapter of the online doc dedicated to development on SA. I believe you will find this section useful: https://docs.microfocus.com/itom/Server_Automation:2018.08/API_Unified/pytwist_1

0 Likes
Micro Focus Expert
Micro Focus Expert

My previous knowledge article link seems to be outdated referencing an old hpe download location.

Please use this link instead: https://softwaresupport.softwaregrp.com/doc/KM00774492

 

0 Likes
Cadet 2nd Class Cadet 2nd Class
Cadet 2nd Class

Thanks much for the examples Boneimre. They are quite useful.
Can you also provide me with any examples around the serverscript service using pytwist ? or guide me on where to find them? I have the code to search for a specific script, pull all the scripts etc... but i want a pytwist code to upload a new script to SA.

Thanks
Venky
0 Likes
Commodore
Commodore

Dimiter Todorov's repository on GitHub is good reference for Twister-based Python scripts.

This one seems to handle executing/creating scripts:
https://github.com/dimitertodorov/SALib/blob/master/serverscript.py

That script references his function library:
https://github.com/dimitertodorov/SALib/blob/master/SALib.py

As a side note, using the API via the Web Services interface allows you to run code from 
any device on the network.

0 Likes
Micro Focus Expert
Micro Focus Expert

0 Likes
Cadet 2nd Class Cadet 2nd Class
Cadet 2nd Class

Hi RandomGuy,
Thanks for the github links. I see there is a code related to create/execute scripts in it. will tweak it a bit and try it out to see if it works for me. Thanks again ! 🙂

- Venky
0 Likes
Cadet 2nd Class Cadet 2nd Class
Cadet 2nd Class

Hi Bengland,
Thanks for the link. But i had already gone through this link but could not find the create script info anywhere in it.

- venky
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.