

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
HPNA : Use task specific credentials in advanced scripts
Hi,
I am leveraging on HPNA Advanced Script (Perl ) while executing "Command Scripts " for certain changes but i am not sure how to use task specifc credentails while running the advanced scripts.
In the below script Opsware::NAS::Connect connects to HPNA using $tc_user_username$ and then
$con->connect( $device ) implicitly uses "Standard Device Credentials" but i want to use task specific credentials.
==
my($host, $port, $user, $pass) = ('localhost','$tc_proxy_telnet_port$','$tc_user_username$','$tc_user_password$');
my $device = '#$tc_device_id$';
my $con = Opsware::NAS::Connect->new(-user => $user, -pass => $pass, -host => $host, -port => $port);
$con->login();
$con->connect( $device ) or die "Failed to connect.";
==
I have restricted the "Command Scripts" to run only via "Use Task Specifc Credentials" under task "Device Credentials Options" but how can the script access these variables to connect to the device ?


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi,
You might have 2 options here.
1. in NA 10.11 request from support a hotfix including interactive login feature for Connect.pm
connect (-devuser x, -devpass y, $tc_device_ip)
Below the list of options including prompts.
item B<connect>-E<gt>( I<%OPTIONS>, I<$device_ip>, I<$prompt_regex> )
Connect to a NA-managed device by giving the IP address and a optional
regular expression that will match the device's command-line prompt.
B<OPTIONS>
=over 8
=item B<-devuser> => I<"User-Name">
Supply a valid user name, the same name you would use to log into
the device.
=item B<-devpass> => I<"Password">
Supply the password for the user given with the B<-devuser> option above.
=item B<-devuserprompt> => I<"Regexp">
Supply the login username prompt.
Can be Regexp, "/regex/", or "regex".
Defaults to 'Login:'.
=item B<-devpassprompt> => I<Regexp>
Supply the login password prompt.
Can be Regexp, "/regex/", or "regex".
Defaults to 'Password:'.
---
The $devuser and $devpass you pull as user defined variables ($devuser$, $devpass$) that can be initialized at task execution in webui.
Option 2.
a. You create command scripts for the commands you need to pass on the device.
b. Your script will call
- mod authentication (-loc db) to add device specific credentials
- run command script, capture output by taskid, etc
- mod authentication or del authentication (-loc db) for the device.
The idea is to bypass the connect() call in your script.
Best regards,
Marius
HP SW Technical Consultant
Cloud and Automation Professional Services


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
The does not answer the question of how to utilize the task specific credentials. It would appear to be a bug that the $tc_device_username$ and $tc_device_password$ are not being set.
The purposed solution of prompting the user for a second set of credentials for set $devusr$ and $devpass$ is undesirable since the script will update the password in the clear and it will be in the clear in any log files, not to mention the redundancy of having to type in the credentials twice.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi Larry / Marlus,
What would be a good solution in this case then ? its more of a bug as you mentioned , there must be a way for user specific task to be passed to the advanced script as it helps to track the user who made the changes .