cookbook-cq icon indicating copy to clipboard operation
cookbook-cq copied to clipboard

Existing array attribute can't be replaced with plain string value

Open jwadolowski opened this issue 7 years ago • 0 comments

Existing JCR node:

{
  "jcr:primaryType": "sling:Folder",
  "windowScheduleWeekdays": [
    "2",
    "2"
  ],
  "jcr:createdBy": "admin",
  "jcr:created": "Thu Feb 08 2018 16:38:40 GMT+0100",
  "windowSchedule": "weekly",
  "windowStartTime": "05:00",
  "name": "Weekly Maintenance Window",
  "windowEndTime": "06:00"
}

cq_jcr resource:

cq_jcr "Author: weekly maintenance schedule" do
  path "/apps/granite/operations/config/maintenance/granite:weekly"
  username node['cq']['author']['credentials']['login']
  password node['cq']['author']['credentials']['password']
  instance "http://localhost:#{node['cq']['author']['port']}"
  properties(
    'jcr:primaryType' => 'sling:Folder',
    'windowScheduleWeekdays' => '7,7',
    'windowSchedule' => 'weekly',
    'windowStartTime' => '05:00'
    'name' => 'Weekly Maintenance Window',
    'windowEndTime' => '06:00'
  )

  action :create
end

Error during chef-run

==> default:   * cq_jcr[Author: weekly maintenance schedule] action create
==> default:
==> default:
==> default:     ================================================================================
==> default:     Error executing action `create` on resource 'cq_jcr[Author: weekly maintenance schedule]'
==> default:     ================================================================================
==> default:
==> default:     TypeError
==> default:     ---------
==> default:     no implicit conversion of String into Array
==> default:
==> default:     Cookbook Trace:
==> default:     ---------------
==> default:     /var/chef/cache/cookbooks/cq/libraries/provider_cq_jcr.rb:158:in `block in merged_new_resource_properties'
==> default:     /var/chef/cache/cookbooks/cq/libraries/provider_cq_jcr.rb:154:in `merge'
==> default:     /var/chef/cache/cookbooks/cq/libraries/provider_cq_jcr.rb:154:in `merged_new_resource_properties'
==> default:     /var/chef/cache/cookbooks/cq/libraries/provider_cq_jcr.rb:197:in `regular_diff'
==> default:     /var/chef/cache/cookbooks/cq/libraries/provider_cq_jcr.rb:309:in `properties_diff'
==> default:     /var/chef/cache/cookbooks/cq/libraries/provider_cq_jcr.rb:109:in `apply_update'
==> default:     /var/chef/cache/cookbooks/cq/libraries/provider_cq_jcr.rb:68:in `action_create'

jwadolowski avatar Feb 09 '18 12:02 jwadolowski