shinesolutions / ruby_aem

Ruby client for Adobe Experience Manager (AEM) API
Apache License 2.0
13 stars 7 forks source link

Parameters with empty value cause errors #38

Closed mbloch1986 closed 4 years ago

mbloch1986 commented 4 years ago

Describe the bug Passing empty required or optional parameters to swagger-aem cause failure in the execution

For the following actions are we passing empty values:

To Reproduce Steps to reproduce the behavior:

require 'ruby_aem'
irb(main):001:0> client = RubyAem::Aem.new
irb(main):001:0> user = client.user('/home/users/r','replicator')
irb(main):001:0> user.exists.data
irb(main):001:0> user.delete
FFI::NullPointerError: invalid memory read at address=0x0000000000000000
    from /opt/puppetlabs/puppet/lib/ruby/gems/2.4.0/gems/ffi-1.13.1/lib/ffi/pointer.rb:62:in `get_string'
    from /opt/puppetlabs/puppet/lib/ruby/gems/2.4.0/gems/ffi-1.13.1/lib/ffi/pointer.rb:62:in `read_string'
    from /opt/puppetlabs/puppet/lib/ruby/gems/2.4.0/gems/ethon-0.12.0/lib/ethon/easy.rb:287:in `escape'
    from /opt/puppetlabs/puppet/lib/ruby/gems/2.4.0/gems/ethon-0.12.0/lib/ethon/easy/queryable.rb:35:in `block (2 levels) in to_s'
    from /opt/puppetlabs/puppet/lib/ruby/gems/2.4.0/gems/ethon-0.12.0/lib/ethon/easy/queryable.rb:35:in `map'
    from /opt/puppetlabs/puppet/lib/ruby/gems/2.4.0/gems/ethon-0.12.0/lib/ethon/easy/queryable.rb:35:in `block in to_s'
    from /opt/puppetlabs/puppet/lib/ruby/gems/2.4.0/gems/ethon-0.12.0/lib/ethon/easy/queryable.rb:31:in `map'
    from /opt/puppetlabs/puppet/lib/ruby/gems/2.4.0/gems/ethon-0.12.0/lib/ethon/easy/queryable.rb:31:in `to_s'
    from /opt/puppetlabs/puppet/lib/ruby/gems/2.4.0/gems/ethon-0.12.0/lib/ethon/easy/http/actionable.rb:124:in `set_params'
    from /opt/puppetlabs/puppet/lib/ruby/gems/2.4.0/gems/ethon-0.12.0/lib/ethon/easy/http/actionable.rb:106:in `setup'
    from /opt/puppetlabs/puppet/lib/ruby/gems/2.4.0/gems/ethon-0.12.0/lib/ethon/easy/http/post.rb:16:in `setup'
    from /opt/puppetlabs/puppet/lib/ruby/gems/2.4.0/gems/ethon-0.12.0/lib/ethon/easy/http.rb:39:in `http_request'
    from /opt/puppetlabs/puppet/lib/ruby/gems/2.4.0/gems/typhoeus-1.4.0/lib/typhoeus/easy_factory.rb:95:in `get'
    from /opt/puppetlabs/puppet/lib/ruby/gems/2.4.0/gems/typhoeus-1.4.0/lib/typhoeus/request/operations.rb:17:in `run'
    from /opt/puppetlabs/puppet/lib/ruby/gems/2.4.0/gems/typhoeus-1.4.0/lib/typhoeus/request/cacheable.rb:18:in `run'
    from /opt/puppetlabs/puppet/lib/ruby/gems/2.4.0/gems/typhoeus-1.4.0/lib/typhoeus/request/block_connection.rb:34:in `run'
    from /opt/puppetlabs/puppet/lib/ruby/gems/2.4.0/gems/typhoeus-1.4.0/lib/typhoeus/request/stubbable.rb:25:in `run'
    from /opt/puppetlabs/puppet/lib/ruby/gems/2.4.0/gems/typhoeus-1.4.0/lib/typhoeus/request/before.rb:27:in `run'
    from /opt/puppetlabs/puppet/lib/ruby/gems/2.4.0/gems/swagger_aem-3.3.0/lib/swagger_aem/api_client.rb:50:in `call_api'
    from /opt/puppetlabs/puppet/lib/ruby/gems/2.4.0/gems/swagger_aem-3.3.0/lib/swagger_aem/api/sling_api.rb:1894:in `post_node_with_http_info'
    from /opt/puppetlabs/puppet/lib/ruby/gems/2.4.0/gems/ruby_aem-3.8.0/lib/ruby_aem/client.rb:74:in `call'
    from /opt/puppetlabs/puppet/lib/ruby/gems/2.4.0/gems/ruby_aem-3.8.0/lib/ruby_aem/resources/user.rb:50:in `delete'
    from (irb):5
    from /opt/puppetlabs/puppet/bin/irb:11:in `<main>'

Expected behavior The execution should have been successful

Environment (please complete the following information if relevant):

Additional context Issue was determined while using the latest puppet-agent in packer-aem https://github.com/shinesolutions/packer-aem/issues/218

mbloch1986 commented 4 years ago

fixed in 3.9.0