Skip to content

Commit

Permalink
Implement per-resource sorting (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmhughes authored Jul 9, 2024
1 parent 10a0973 commit c7a01fa
Show file tree
Hide file tree
Showing 50 changed files with 58 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ This file is used to list changes made in each version of isc_kea.

## Unreleased

- Add per-resource sorting for all array based configuration resources

## 1.5.0 - *2024-07-08*

- Add sort functions to `config_dhcp4_client_class` and `config_dhcp6_client_class`
Expand Down
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
supports 'scientific'
supports 'ubuntu'

depends 'chef_auto_accumulator', '~> 0.5'
depends 'chef_auto_accumulator', '~> 0.6'
depends 'yum-epel', '~> 4.1'
2 changes: 1 addition & 1 deletion resources/config_dhcp4_client_class.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def auto_accumulator_options_override
{
config_path_override: %w(Dhcp4 client-classes),
config_path_type: :array,
config_path_sort_function: [:fetch, 'name'],
config_path_sort_keys: %w(name),
config_match: {
'name' => class_name,
},
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp4_global_host_reservation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def auto_accumulator_options_override
{
config_path_override: %w(Dhcp4 reservations),
config_path_type: :array,
config_path_sort_keys: %w(ip_address),
config_match: {
'ip_address' => ip_address,
},
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp4_hooks_library.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def auto_accumulator_options_override
{
config_path_override: %w(Dhcp4 hooks-libraries),
config_path_type: :array,
config_path_sort_keys: %w(library),
config_match: {
'library' => library,
},
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp4_loggers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def auto_accumulator_options_override
{
config_path_override: %w(Dhcp4 loggers),
config_path_type: :array,
config_path_sort_keys: %w(name),
config_match: {
'name' => logger_name,
},
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp4_loggers_output.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def auto_accumulator_options_override
config_properties_skip: %i(logger_name),
config_path_override: %w(Dhcp4 loggers),
config_path_type: :array_contained,
config_path_sort_keys: %w(library),
config_path_match_key: 'name',
config_path_match_value: logger_name,
config_path_contained_key: 'output_options',
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp4_option_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def auto_accumulator_options_override
{
config_path_override: %w(Dhcp4 option-data),
config_path_type: :array,
config_path_sort_keys: %w(name),
config_match: {
'name' => option_name,
'code' => code,
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp4_option_def.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def auto_accumulator_options_override
{
config_path_override: %w(Dhcp4 option-def),
config_path_type: :array,
config_path_sort_keys: %w(code name),
config_match: {
'name' => option_name,
'code' => code,
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp4_shared_network.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def auto_accumulator_options_override
{
config_path_override: %w(Dhcp4 shared-networks),
config_path_type: :array,
config_path_sort_keys: %w(name),
config_match: {
'name' => network_name,
},
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp4_shared_network_option_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def auto_accumulator_options_override
config_properties_skip: %i(shared_network_name),
config_path_override: %w(Dhcp4 shared-networks),
config_path_type: :array_contained,
config_path_sort_keys: %w(code name),
config_path_match_key: 'name',
config_path_match_value: shared_network_name,
config_path_contained_key: 'option-data',
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp4_shared_network_subnet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def auto_accumulator_options_override
config_properties_skip: %i(shared_network_name),
config_path_override: %w(Dhcp4 shared-networks),
config_path_type: :array_contained,
config_path_sort_keys: %w(subnet),
config_path_match_key: 'name',
config_path_match_value: shared_network_name,
config_path_contained_key: 'subnet4',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def auto_accumulator_options_override
config_properties_skip: %i(shared_network_name subnet),
config_path_override: %w(Dhcp4 shared-networks),
config_path_type: :array_contained,
config_path_sort_keys: %w(code name),
config_path_match_key: %w(name subnet),
config_path_match_value: [ shared_network_name, subnet ],
config_path_contained_key: %w(subnet4 option-data),
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp4_shared_network_subnet_pool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def auto_accumulator_options_override
config_properties_skip: %i(subnet shared_network_name),
config_path_override: %w(Dhcp4 shared-networks),
config_path_type: :array_contained,
config_path_sort_keys: %w(pool),
config_path_match_key: %w(name subnet),
config_path_match_value: [ shared_network_name, subnet ],
config_path_contained_key: %w(subnet4 pools),
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp4_subnet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def auto_accumulator_options_override
{
config_path_override: %w(Dhcp4 subnet4),
config_path_type: :array,
config_path_sort_keys: %w(id subnet),
config_match: {
'subnet' => subnet,
'id' => id,
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp4_subnet_host_reservation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def auto_accumulator_options_override
config_properties_skip: %i(subnet),
config_path_override: %w(Dhcp4 subnet4),
config_path_type: :array_contained,
config_path_sort_keys: %w(ip_address),
config_path_match_key: 'subnet',
config_path_match_value: subnet,
config_path_match: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def auto_accumulator_options_override
config_properties_skip: %i(subnet ip_address),
config_path_override: %w(Dhcp4 subnet4),
config_path_type: :array_contained,
config_path_sort_keys: %w(code name),
config_path_match_key: %w(subnet ip-address),
config_path_match_value: [ subnet, ip_address ],
config_path_contained_key: %w(reservations option-data),
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp4_subnet_option_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def auto_accumulator_options_override
config_properties_skip: %i(subnet),
config_path_override: %w(Dhcp4 subnet4),
config_path_type: :array_contained,
config_path_sort_keys: %w(code name),
config_path_match_key: 'subnet',
config_path_match_value: subnet,
config_path_contained_key: 'option-data',
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp4_subnet_pool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def auto_accumulator_options_override
config_properties_skip: %i(subnet),
config_path_override: %w(Dhcp4 subnet4),
config_path_type: :array_contained,
config_path_sort_keys: %w(pool),
config_path_match_key: 'subnet',
config_path_match_value: subnet,
config_path_contained_key: 'pools',
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp4_subnet_pool_option_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def auto_accumulator_options_override
config_properties_skip: %i(subnet pool),
config_path_override: %w(Dhcp4 subnet4),
config_path_type: :array_contained,
config_path_sort_keys: %w(code name),
config_path_match_key: %w(subnet pool),
config_path_match_value: [ subnet, pool ],
config_path_contained_key: %w(pools option-data),
Expand Down
2 changes: 1 addition & 1 deletion resources/config_dhcp6_client_class.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def auto_accumulator_options_override
{
config_path_override: %w(Dhcp6 client-classes),
config_path_type: :array,
config_path_sort_function: [:fetch, 'name'],
config_path_sort_keys: %w(name),
config_match: {
'name' => class_name,
},
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp6_config_control_config_database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def auto_accumulator_options_override
{
config_path_override: %w(Dhcp6 config-control config-databases),
config_path_type: :array,
config_path_sort_keys: %w(name),
config_match: {
'name' => database_name,
},
Expand Down
3 changes: 2 additions & 1 deletion resources/config_dhcp6_global_host_reservation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ def auto_accumulator_options_override
{
config_path_override: %w(Dhcp6 reservations),
config_path_type: :array,
config_path_sort_keys: %w(ip_addresses),
config_match: {
'ip_address' => ip_address,
'ip_addresses' => ip_addresses,
},
permit_nil_properties: true,
}.freeze
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp6_hooks_library.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def auto_accumulator_options_override
{
config_path_override: %w(Dhcp6 hooks-libraries),
config_path_type: :array,
config_path_sort_keys: %w(library),
config_match: {
'library' => library,
},
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp6_loggers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def auto_accumulator_options_override
{
config_path_override: %w(Dhcp6 loggers),
config_path_type: :array,
config_path_sort_keys: %w(name),
config_match: {
'name' => logger_name,
},
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp6_loggers_output.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def auto_accumulator_options_override
config_properties_skip: %i(logger_name),
config_path_override: %w(Dhcp6 loggers),
config_path_type: :array_contained,
config_path_sort_keys: %w(library),
config_path_match_key: 'name',
config_path_match_value: logger_name,
config_path_contained_key: 'output_options',
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp6_option_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def auto_accumulator_options_override
{
config_path_override: %w(Dhcp6 option-data),
config_path_type: :array,
config_path_sort_keys: %w(name),
config_match: {
'name' => option_name,
'code' => code,
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp6_option_def.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def auto_accumulator_options_override
{
config_path_override: %w(Dhcp6 option-def),
config_path_type: :array,
config_path_sort_keys: %w(code name),
config_match: {
'name' => option_name,
'code' => code,
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp6_shared_network.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def auto_accumulator_options_override
{
config_path_override: %w(Dhcp6 shared-networks),
config_path_type: :array,
config_path_sort_keys: %w(name),
config_path_match_key: 'name',
config_path_match_value: network_name,
property_translation_matrix: {
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp6_shared_network_option_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def auto_accumulator_options_override
config_properties_skip: %i(shared_network_name),
config_path_override: %w(Dhcp6 shared-networks),
config_path_type: :array_contained,
config_path_sort_keys: %w(code name),
config_path_match_key: 'name',
config_path_match_value: shared_network_name,
config_path_contained_key: 'option-data',
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp6_shared_network_subnet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def auto_accumulator_options_override
config_properties_skip: %i(shared_network_name),
config_path_override: %w(Dhcp6 shared-networks),
config_path_type: :array_contained,
config_path_sort_keys: %w(subnet),
config_path_match_key: 'name',
config_path_match_value: shared_network_name,
config_path_contained_key: 'subnet4',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def auto_accumulator_options_override
config_properties_skip: %i(shared_network_name subnet),
config_path_override: %w(Dhcp6 shared-networks),
config_path_type: :array_contained,
config_path_sort_keys: %w(code name),
config_path_match_key: %w(name subnet),
config_path_match_value: [ shared_network_name, subnet ],
config_path_contained_key: %w(subnet6 option-data),
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp6_shared_network_subnet_pd_pool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def auto_accumulator_options_override
config_properties_skip: %i(subnet),
config_path_override: %w(Dhcp6 shared-networks),
config_path_type: :array_contained,
config_path_sort_keys: %w(pool),
config_path_match_key: %w(name subnet),
config_path_match_value: [ shared_network_name, subnet ],
config_path_contained_key: %w(subnet6 pd-pools),
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp6_shared_network_subnet_pool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def auto_accumulator_options_override
config_properties_skip: %i(subnet shared_network_name),
config_path_override: %w(Dhcp6 shared-networks),
config_path_type: :array_contained,
config_path_sort_keys: %w(subnet),
config_path_match_key: %w(name subnet),
config_path_match_value: [ shared_network_name, subnet ],
config_path_contained_key: %w(subnet6 pools),
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp6_subnet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def auto_accumulator_options_override
{
config_path_override: %w(Dhcp6 subnet6),
config_path_type: :array,
config_path_sort_keys: %w(id subnet),
config_match: {
'subnet' => subnet,
'id' => id,
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp6_subnet_host_reservation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def auto_accumulator_options_override
config_properties_skip: %i(subnet),
config_path_override: %w(Dhcp6 subnet6),
config_path_type: :array_contained,
config_path_sort_keys: %w(ip_addresses),
config_path_match_key: 'subnet',
config_path_match_value: subnet,
config_path_contained_key: 'reservations',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def auto_accumulator_options_override
config_properties_skip: %i(subnet ip_addresses),
config_path_override: %w(Dhcp6 subnet6),
config_path_type: :array_contained,
config_path_sort_keys: %w(code name),
config_path_match_key: %w(subnet ip-addresses),
config_path_match_value: [ subnet, ip_addresses ],
config_path_contained_key: %w(reservations option-data),
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp6_subnet_option_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def auto_accumulator_options_override
config_properties_skip: %i(subnet),
config_path_override: %w(Dhcp6 subnet6),
config_path_type: :array_contained,
config_path_sort_keys: %w(code name),
config_path_match_key: 'subnet',
config_path_match_value: subnet,
config_path_contained_key: 'option-data',
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp6_subnet_pd_pool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def auto_accumulator_options_override
config_properties_skip: %i(subnet),
config_path_override: %w(Dhcp6 subnet6),
config_path_type: :array_contained,
config_path_sort_keys: %w(prefix),
config_path_match_key: 'subnet',
config_path_match_value: subnet,
config_path_contained_key: 'pd-pools',
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp6_subnet_pool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def auto_accumulator_options_override
config_properties_skip: %i(subnet),
config_path_override: %w(Dhcp6 subnet6),
config_path_type: :array_contained,
config_path_sort_keys: %w(pool),
config_path_match_key: 'subnet',
config_path_match_value: subnet,
config_path_contained_key: 'pools',
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp6_subnet_pool_option_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def auto_accumulator_options_override
config_properties_skip: %i(subnet pool),
config_path_override: %w(Dhcp6 subnet6),
config_path_type: :array_contained,
config_path_sort_keys: %w(code name),
config_path_match_key: %w(subnet pool),
config_path_match_value: [ subnet, pool ],
config_path_contained_key: %w(pools option-data),
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp6_subnet_prefix_delegation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def auto_accumulator_options_override
config_properties_skip: %i(subnet_id),
config_path_override: %w(Dhcp6 subnet6),
config_path_type: :array_contained,
config_path_sort_keys: %w(prefix),
config_path_match_key: 'subnet',
config_path_match_value: subnet,
config_path_contained_key: 'reservations',
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp_ddns_forward_ddns_domain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def auto_accumulator_options_override
{
config_path_override: %w(DhcpDdns forward-ddns ddns-domains),
config_path_type: :array,
config_path_sort_keys: %w(name),
config_match: {
'name' => zone_name,
},
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp_ddns_hooks_library.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def auto_accumulator_options_override
{
config_path_override: %w(DhcpDdns hooks-libraries),
config_path_type: :array,
config_path_sort_keys: %w(library),
config_match: {
'library' => library,
},
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp_ddns_loggers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def auto_accumulator_options_override
{
config_path_override: %w(DhcpDdns loggers),
config_path_type: :array,
config_path_sort_keys: %w(name),
config_match: {
'name' => logger_name,
},
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp_ddns_loggers_output.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def auto_accumulator_options_override
config_properties_skip: %i(logger_name),
config_path_override: %w(DhcpDdns loggers),
config_path_type: :array_contained,
config_path_sort_keys: %w(library),
config_path_match_key: 'name',
config_path_match_value: logger_name,
config_path_contained_key: 'output_options',
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp_ddns_reverse_ddns_domain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def auto_accumulator_options_override
{
config_path_override: %w(DhcpDdns reverse-ddns ddns-domains),
config_path_type: :array,
config_path_sort_keys: %w(name),
config_match: {
'name' => zone_name,
},
Expand Down
1 change: 1 addition & 0 deletions resources/config_dhcp_ddns_tsig_key.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def auto_accumulator_options_override
{
config_path_override: %w(DhcpDdns tsig-keys),
config_path_type: :array,
config_path_sort_keys: %w(name),
config_match: {
'name' => key_name,
},
Expand Down
4 changes: 4 additions & 0 deletions resources/partial/_config_auto_accumulator_kea.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
property :filemode, String,
default: '0644'

property :sort, [true, false],
default: false,
desired_state: false

property :extra_options, Hash,
coerce: proc { |p| p.transform_keys(&:to_s) }

Expand Down
Loading

0 comments on commit c7a01fa

Please sign in to comment.