Custom Link with Services #8347
-
Hello! {% if obj.service.name == 'ssh' %} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
I didn't look deeply into this but note that in the first line you reference object.service.name and in the subsequent line object.services.name which are not the same.
—
Mark Tinberg ***@***.***>
Division of Information Technology-Network Services
University of Wisconsin-Madison
…________________________________
From: brunodangelos ***@***.***>
Sent: Thursday, January 13, 2022 12:49 PM
To: netbox-community/netbox ***@***.***>
Cc: Subscribed ***@***.***>
Subject: [netbox-community/netbox] Custom Link with Services (Discussion #8347)
Hello!
I'm a newby with Netbox and trying to create a custom link which uses a service ports assigned to a specific device. The content type i'm using is DCIM>device to show a link in this case. I am using this in the Link Text template field
{% if obj.service.name == 'ssh' %}
ssh://{{obj.cf['user']}}@{{obj.primary_ip.address.ip}} -p {{obj.services.name}}
{% endif %}
but nothing shows up, what am i not doing right?
—
Reply to this email directly, view it on GitHub<#8347>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAS7UMYJPO3PQHSWBI7CLB3UV4NDXANCNFSM5L4UBRWQ>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
A device can have multiple services associated with it, so you presumably want to check for any service named
That will return True if there's a service named |
Beta Was this translation helpful? Give feedback.
A device can have multiple services associated with it, so you presumably want to check for any service named
ssh
. You could do something like this:That will return True if there's a service named
ssh
associated with the device.