10-31-2016 04:37 AM
Hi All,
I've been using POST cliTemplateConfiguration/upload to upload CLI Templates into Prime but I'm having issues with templates which use global variables (they're not being populated when I deploy the template). If I post the following template with local variables I can deploy without a problem and the hostname gets set to 'carlsrouter'
<?xml version="1.0" ?>
<cliTemplate>
<content>hostname $hostname
</content>
<description>Applies Hostname</description>
<deviceType>Routers</deviceType>
<lastDeployTime>2016-10-24T17:08:32.594+01:00</lastDeployTime>
<name>ZEN-HOSTNAME-POSTED</name>
<path>My Templates/Zen Service Templates</path>
<variables>
<variable>
<defaultValue>carlsrouter</defaultValue>
<description>Device Host Name</description>
<displayLabel>Hostname</displayLabel>
<name>hostname</name>
<required>false</required>
<type>String</type>
</variable>
</variables>
</cliTemplate>
If I upload the following template into Prime via the API and deploy I get a router named '$gv.lab-hostname' :
<?xml version="1.0" ?>
<cliTemplate>
<content>hostname $gv.lab-hostname
</content>
<description>Applies Hostname2</description>
<deviceType>Routers</deviceType>
<name>ZEN-HOSTNAME-POSTED2</name>
<path>My Templates/Provisioning Templates</path>
</cliTemplate>
If I create either template using the Web UI they work without a problem.
Is there something special I need to do when uploading templates which use global variables via the API?
Thanks,
Carl
11-02-2016 02:55 PM
What version of Prime Infrastructure are you using? We tried reproducing this issue on 3.1.0 but couldn't get it to reproduce. As long as we defined the global variable in the UI, simply specifying it in the cliTemplate/content request parameter, like you do in your ZEN-HOSTNAME-POSTED2 example, works.
11-04-2016 05:57 AM
Hi Spencer,
Thanks for the feedback. I'm using Build 3.1.0.0.132
Once I've POSTed the template to Prime (e.g. curl -H "Content-Type: text/xml" --data-binary @ZEN-HOSTNAME-POSTED3.xml -X POST -u username 'https://cpi01.example.com/webacs/api/v2/op/cliTemplateConfiguration/upload')
You can see that when going to deploy the template through the Web GUI it doesn't recognise that I've provided a template with Global Variables (When the 'Form' button is selected):
But if I select the 'CLI' button you can see that the global variable is there:
Just to show the variable exists as a global variable:
If I search for and add the $gv.lab-hostname variable to the template through the Web GUI and save the template, it kicks it working using the global variables again.
i.e Web GUI update to make the template content look like this (then click save):
"
hostname $gv.lab-hostname
$gv.lab-hostname
"
Then I see the expected form values when trying to deploy:
Were you using the exact same build when you tried to replicate?
Thanks,
Carl
11-14-2016 01:52 PM
Carl, my apologies. There was a UI save happening afterwards that would cause the template to function properly during deployment when we attempted to reproduce this issue. We'll work on getting this issue fixed. I've created CSCvc11240 to track this issue (it's not publicly visible yet but should be within 24 hours).
Workarounds we'd suggest right now is either:
Thank you for bringing this issue up and thank you for your patience. I very much appreciate it.
Edit: bug is now visible, added link
11-16-2016 10:15 AM
Hi Spencer,
Thanks for the update, hopefully the fix is simple and can be rolled out quickly.
Regards,
Carl
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide