Closed w0de closed 4 months ago
@thejoeker12 , your thoughts on this ?
Just some testing from the Jamf API around how groups will appear when configured differently
<?xml version="1.0" encoding="UTF-8"?>
<computer_group>
<id>1</id>
<name>Smart Group - No Criteria - No Site</name>
<is_smart>true</is_smart>
<site>
<id>-1</id>
<name>None</name>
</site>
<criteria>
<size>0</size>
</criteria>
<computers>
<size>2</size>
<computer>
<id>2</id>
<name>Admin’s Virtual Machine</name>
<mac_address>EA:C2:AE:67:E3:42</mac_address>
<alt_mac_address>62:D4:E8:1A:B1:18</alt_mac_address>
<serial_number>ZH24QT6HM9</serial_number>
</computer>
<computer>
<id>3</id>
<name>admin’s Virtual Machine</name>
<mac_address>16:35:03:41:39:6B</mac_address>
<alt_mac_address>DA:93:27:EE:D2:58</alt_mac_address>
<serial_number>Z46916D5X3</serial_number>
</computer>
</computers>
</computer_group>
<?xml version="1.0" encoding="UTF-8"?>
<computer_group>
<id>2</id>
<name>Smart Group - With Criteria - No Site</name>
<is_smart>true</is_smart>
<site>
<id>-1</id>
<name>None</name>
</site>
<criteria>
<size>1</size>
<criterion>
<name>Model</name>
<priority>0</priority>
<and_or>and</and_or>
<search_type>like</search_type>
<value>Mac</value>
<opening_paren>false</opening_paren>
<closing_paren>false</closing_paren>
</criterion>
</criteria>
<computers>
<size>2</size>
<computer>
<id>2</id>
<name>Admin’s Virtual Machine</name>
<mac_address>EA:C2:AE:67:E3:42</mac_address>
<alt_mac_address>62:D4:E8:1A:B1:18</alt_mac_address>
<serial_number>ZH24QT6HM9</serial_number>
</computer>
<computer>
<id>3</id>
<name>admin’s Virtual Machine</name>
<mac_address>16:35:03:41:39:6B</mac_address>
<alt_mac_address>DA:93:27:EE:D2:58</alt_mac_address>
<serial_number>Z46916D5X3</serial_number>
</computer>
</computers>
</computer_group>
<?xml version="1.0" encoding="UTF-8"?>
<computer_group>
<id>3</id>
<name>Smart Group - No Criteria - With Site</name>
<is_smart>true</is_smart>
<site>
<id>1</id>
<name>Test</name>
</site>
<criteria>
<size>0</size>
</criteria>
<computers>
<size>1</size>
<computer>
<id>2</id>
<name>Admin’s Virtual Machine</name>
<mac_address>EA:C2:AE:67:E3:42</mac_address>
<alt_mac_address>62:D4:E8:1A:B1:18</alt_mac_address>
<serial_number>ZH24QT6HM9</serial_number>
</computer>
</computers>
</computer_group>
<?xml version="1.0" encoding="UTF-8"?>
<computer_group>
<id>4</id>
<name>Smart Group - With Criteria - With Site</name>
<is_smart>true</is_smart>
<site>
<id>1</id>
<name>Test</name>
</site>
<criteria>
<size>1</size>
<criterion>
<name>Model</name>
<priority>0</priority>
<and_or>and</and_or>
<search_type>like</search_type>
<value>Mac</value>
<opening_paren>false</opening_paren>
<closing_paren>false</closing_paren>
</criterion>
</criteria>
<computers>
<size>1</size>
<computer>
<id>2</id>
<name>Admin’s Virtual Machine</name>
<mac_address>EA:C2:AE:67:E3:42</mac_address>
<alt_mac_address>62:D4:E8:1A:B1:18</alt_mac_address>
<serial_number>ZH24QT6HM9</serial_number>
</computer>
</computers>
</computer_group>
<?xml version="1.0" encoding="UTF-8"?>
<computer_group>
<id>5</id>
<name>Static Group - With Site</name>
<is_smart>false</is_smart>
<site>
<id>1</id>
<name>Test</name>
</site>
<criteria>
<size>0</size>
</criteria>
<computers>
<size>1</size>
<computer>
<id>2</id>
<name>Admin’s Virtual Machine</name>
<mac_address>EA:C2:AE:67:E3:42</mac_address>
<alt_mac_address>62:D4:E8:1A:B1:18</alt_mac_address>
<serial_number>ZH24QT6HM9</serial_number>
</computer>
</computers>
</computer_group>
<?xml version="1.0" encoding="UTF-8"?>
<computer_group>
<id>6</id>
<name>Static Group - No Site</name>
<is_smart>false</is_smart>
<site>
<id>-1</id>
<name>None</name>
</site>
<criteria>
<size>0</size>
</criteria>
<computers>
<size>1</size>
<computer>
<id>2</id>
<name>Admin’s Virtual Machine</name>
<mac_address>EA:C2:AE:67:E3:42</mac_address>
<alt_mac_address>62:D4:E8:1A:B1:18</alt_mac_address>
<serial_number>ZH24QT6HM9</serial_number>
</computer>
</computers>
</computer_group>
Will not merge yet as likely to rewrite all of this logic today to bring up to latest patterns.
Howdy, release v0.0.58 has the split now for smart and static computer groups. Which simplifies the stating complexity. The site block is optional in .hcl and only stated for non null values. Aka not -1, etc. I'll reject the PR based on the direction we are now taking with this resource type. Thanks
Intended to address the issue described here.
This restores a site check to computer groups validation. I've amended the logic so that we shouldn't see any list index exceptions when/if
site
is entirely empty.I'm not really sure of several things:
site
is not defined, anyways? Can't we just discard them?* That exception: