Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reusing CryptoHelper in cq_osgi_config #74

Open
karoldrazek opened this issue Mar 21, 2019 · 0 comments
Open

Reusing CryptoHelper in cq_osgi_config #74

karoldrazek opened this issue Mar 21, 2019 · 0 comments

Comments

@karoldrazek
Copy link

I've tried executing following code:

cq_osgi_config 'config' do
  extend Cq::CryptoHelper
  username node['cq']['author']['credentials']['login']
  password node['cq']['author']['credentials']['password']
  instance "http://localhost:#{node['cq']['author']['port']}"
  factory_pid 'org.apache.jackrabbit.oak.security.authentication.ldap.impl.LdapIdentityProvider'
  unique_fields [
      'provider.name'
  ]
  properties(
      'provider.name' => 'ldap',
      'host.name' => node['webapp']['ldap']['host_name'],
      'host.port' => node['webapp']['ldap']['host_port'],
      'bind.dn' => "dn_path",
      'bind.password' => encrypt(
        "http://localhost:#{node['cq']['author']['port']}",
        node['cq']['author']['credentials']['login'],
        node['cq']['author']['credentials']['password'],
        node['webapp']['ldap']['service_user']['password']
        ),
      'user.baseDN' => 'base_ou_path',
      'user.idAttribute' => 'sAMAccountName',
      'user.extraFilter' => "filters",
  )

  action :create
end

Unfortunately it seems that variable and method share the same name:
Method: https://github.com/jwadolowski/cookbook-cq/blob/master/libraries/_crypto_helper.rb#L309
Variable: https://github.com/jwadolowski/cookbook-cq/blob/master/libraries/resource_cq_osgi_config.rb#L55

which results in following error:

==> default:     ArgumentError
==> default:     -------------
==> default:     wrong number of arguments (given 0, expected 1)
==> default:
==> default:     Cookbook Trace:
==> default:     ---------------
==> default:     /var/chef/cache/cookbooks/cq/libraries/_crypto_helper.rb:309:in `sleep_time'
==> default:
==> default: /var/chef/cache/cookbooks/cq/libraries/provider_cq_osgi_config.rb:42:in `load_current_resource'
==> default:

Note: The above use of extension works fine for cq_jcr resource.

Please kindly consider enabling encrypted_fields for other resources, externalizing the CryptoHelper or at least changing the naming a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant