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

@inv_client.create_resource does not return path when resource already exists #180

Closed
pilhuhn opened this issue Dec 14, 2016 · 0 comments
Closed
Assignees
Milestone

Comments

@pilhuhn
Copy link
Member

pilhuhn commented Dec 14, 2016

This goes

def create_resource_under_resource
...
      rescue HawkularException => error
        # 409 We already exist -> that is ok
        raise unless error.status_code == 409
      end
      Resource.new(res)

In case of the 409, we still return a Resource, but constructed from the input, which does not contain the path.

The path needs to be obtained by clients like this:

resource = @inv_client.create_resource  type_path, data['r'], data['r']
  if resource.path.nil?
    resources = @inv_client.list_resources_for_type type_path, true
    resource = resources.first
  end

We should perhaps internalise getting the path into create_resource to have a consistent behaviour in both cases.

@josejulio josejulio self-assigned this Jan 4, 2017
josejulio added a commit to josejulio/hawkular-client-ruby that referenced this issue Jan 6, 2017
@jkremser jkremser added this to the 2.9.0 milestone Mar 13, 2017
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

3 participants