>
>>> I tend to like the unified/no subresources approach better as it seems
>>> less cluttered and a lot simpler. However, my concern would be what do
>>> we do about conflicts? Suppose Foreman implements a host action (eg
>>> packages, puppet-classes, etc) that Katello is already defining. If a
>>> conflict does arise and Katello has to use another route, that’s going
>>> to be problematic in that Katello is suppose to maintain backwards
>>> compatibility in its API between releases. If we have subresources I
>>> think a conflict would be less likely.
>> I would also add that if a host can have different features/facets
>> enabled or disabled it would help the user match up which actions
>> correspond to which facet with a 'namespaced/subresource' approach.
>> Otherwise a user would have no idea which rest actions correspond with
>> the 'puppet' facet if the puppet aspect is not enabled for a particular
>> host.
>>
>> -Justin
> As a consumer of a host, I don't think I should have to arbitrarily know if a host has the puppet facet or not.
>
> GET /api/hosts/$id/puppetclass_ids -> []
> POST /api/hosts/$id/puppetclass_ids <-- Creates a puppet facet if one doesn't exist yet?
>
> Or do I need to query the host itself to get a "these are your facets" result?
>
> GET /api/hosts/$id -> {facets: {puppet: false, salt: false, chef: false, content: true, subscription: true}}
>
> Even without puppet being true, might I not still have puppet content?
There's no such thing as 'having puppet content', but even if there were
I would imagine that'd be under the content aspect.
>
> GET /api/hosts/$id/puppet_modules <- Hypothetical route to return puppet from host's lifecycle environment
>
> You are asking me, the user, to know that although it's a single host object it is really several objects (facets) in the tool. And also to know what fields come from which facet, even if they are conceptually related.
It not knowing about where to get fields/attributes, its more to do with
other actions.
>
> Would I have to
> GET /api/hosts/$id/puppet
> GET /api/hosts/$id/subscription
> GET /api/hosts/$id/content
> <combine results client side>
> POST /api/hosts/$id/puppet
> POST /api/hosts/$id/subscription
> POST /api/hosts/$id/content
>
> My opinion is that we go all-in and combine hosts. We are, in fact, a single project and community. There won't be name clashes because a PR to either foreman or katello with a clash would be NACKed.
No, the attributes of all the facets are combined together on the host json:
GET /api/hosts/$id would return:
{ 'id': 3,
'puppet_facet': {
'environment_id': 2
},
'content_facet': {
'content_view_id': 4
}
}
This is more referring to actions associated with a specific facet. For
puppet that would be: /api/hosts/$id/puppet/puppetrun, for content
that would be: /api/hosts/$id/content/packages as examples.
If the purpose is to go 'all-in' and combine hosts, why even use
facets? Just throw everything on the host object and 'hope' there are
no collisions. Are you going to monitor every plugin that anyone writes
to validate there are no conflicts? This isn't just about foreman and
katello, but also scap, discovery, remote execution, docker, ostree, and
any other plugin that people want to write. The whole purpose of
separating the model into facets is to provide for a separation of
concerns and reduce conflicts, why not extend that to the api?
-Justin
···
On 11/11/2015 08:20 AM, Tom McKay wrote:
> ----- Original Message -----
>> On 11/10/2015 05:18 PM, David Davis wrote:
David
On Tue, Nov 10, 2015 at 4:21 PM, Tom McKay <thomasmckay@redhat.com >>> mailto:thomasmckay@redhat.com> wrote:
----- Original Message -----
> Hey,
>
> Apologies for reviving this thread, I somehow missed it
originally and this
> issue has come up for me during the work on my PR [1] to move
packages from
> systems to hosts.
>
> I'm personally in favor of just adding the sub-resources
directly to the base
> resource object, without the split. In other words:
>
> /host/:id/puppet-classes
> /host/:id/packages
>
> vs
>
> /host/:id/puppet/classes
> /host/:id/content/packages
>
> The main reason being that you cannot CRUD /host/:id/puppet or
> /host/:id/content; puppet and content are not resources, they are an
> arbitrary (and somewhat meaningless to our users) grouping of
aspects (or
> facets?). I think that consumers of our APIs will be confused
about the
> superfluous /content or /puppet and this pattern is also
contrary to every
> other REST API I have seen.
>
> Thoughts?
>
> Cheers,
> Walden
>
> [1] https://github.com/Katello/katello/pull/5575
>
>
>
I too would prefer not having sub-resources.
First, I don't want to try to get the existing foreman APIs to
change their structure. Katello influence on core foreman has
never been smooth and the topic of the API has already been
thrashed about over the past couple years. Putting the details
directly onto the host API means foreman doesn't need to change
and things can progress.
Second, the reason for this host unification work is to allow the
host object to be thought of as a single object. If API routes are
going to be segregated off by topic (assuming my first point is
proven to be incorrect) then it is just exposing implementation
details to the user. For example, there are certainly going to be
attributes that bleed between two facets and I'd rather see the
PUT /hosts/$id be able to work with a single call versus multiple.
--
You received this message because you are subscribed to the Google
Groups "foreman-dev" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to foreman-dev+unsubscribe@googlegroups.com
<mailto:foreman-dev%2Bunsubscribe@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.
–
You received this message because you are subscribed to the Google
Groups “foreman-dev” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to foreman-dev+unsubscribe@googlegroups.com
mailto:foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
–
You received this message because you are subscribed to the Google Groups
"foreman-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.