-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -186,11 +186,11 @@ def create_host(self, device, cred, params: Dict): | |
|
||
if not device.platform: | ||
raise NornirNautobotException(f"Platform missing from device {device.name}, preemptively failed.") | ||
host["platform"] = device.platform.slug | ||
host["platform"] = device.platform.network_driver | ||
host["data"]["id"] = device.id | ||
host["data"]["type"] = device.device_type.slug | ||
host["data"]["location"] = device.location.slug | ||
host["data"]["role"] = device.role.slug | ||
host["data"]["type"] = device.device_type.model | ||
host["data"]["location"] = device.location.name | ||
host["data"]["role"] = device.role.name | ||
host["data"]["config_context"] = dict(device.get_config_context()) | ||
host["data"]["custom_field_data"] = device.custom_field_data | ||
host["data"]["obj"] = device | ||
|
@@ -234,16 +234,16 @@ def get_host_groups(device): | |
""" | ||
groups = [ | ||
"global", | ||
f"location__{device.location.slug}", | ||
f"role__{device.role.slug}", | ||
f"type__{device.device_type.slug}", | ||
f"manufacturer__{device.device_type.manufacturer.slug}", | ||
f"location__{device.location.name}", | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
itdependsnetworks
Contributor
|
||
f"role__{device.role.name}", | ||
f"type__{device.device_type.model}", | ||
f"manufacturer__{device.device_type.manufacturer.name}", | ||
] | ||
|
||
if device.platform: | ||
groups.append(f"platform__{device.platform.slug}") | ||
groups.append(f"platform__{device.platform.network_driver}") | ||
|
||
if device.tenant: | ||
groups.append(f"tenant__{device.tenant.slug}") | ||
groups.append(f"tenant__{device.tenant.name}") | ||
|
||
return groups |
This will likely break with special characters. Same for others with name.