[
https://issues.apache.org/jira/browse/AMBARI-23147?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated AMBARI-23147:
------------------------------------
Labels: pull-request-available (was: )
> Expose Repository CRUD via the Mpack Endpoint
> ---------------------------------------------
>
> Key: AMBARI-23147
> URL: https://issues.apache.org/jira/browse/AMBARI-23147
> Project: Ambari
> Issue Type: Task
> Affects Versions: 3.0.0
> Reporter: Jonathan Hurley
> Assignee: Jonathan Hurley
> Priority: Critical
> Labels: pull-request-available
> Fix For: 3.0.0
>
>
> With the removal of version definitions and repository versions, we need a
> new way of exposing and managing repositories. Since repositories are now
> associated with management packs, it makes sense to expose these off of the
> {{mpack}} endpoint.
> The question is whether we want to continue our model of having
> OperatingSystems read-only and adding sub-resources of repositories off of
> the OS or changing to something simpler like having a single object
> serialized which contains all of the information.
> h5. Scenario 1: Operating Systems are 1st Class Resources
> I think that having each repository as a sub-resource is a bit of an
> overkill. We certainly don't need that level of granularity. But we could
> make the {{operating_system}} the lowest level so that you could update all
> repositories for a given operating system at once. For example:
> {code:title=http://c7001.ambari.apache.org:8080/api/v1/mpacks/1}
> {
> {
> "href": "http://c7401.ambari.apache.org:8080/api/v1/mpacks/1",
> "MpackInfo": {
> "id": 1,
> "mpack_description": "Hortonworks Data Platform Core",
> "mpack_id": "hdpcore",
> "mpack_name": "HDPCORE",
> "mpack_uri":
> "http://repo.ambari.apache.org/hdpcore/centos7/HDPCORE-1.0.0-b96/mpack.json",
> "mpack_version": "1.0.0-b96",
> "operating_systems": [
> {
> "href":
> "http://c7401.ambari.apache.org:8080/api/v1/stacks/HDPCORE/versions/1.0.0-b96/operating_systems/redhat7",
> "OperatingSystems": {
> "os_type": "redhat7",
> "stack_name": "HDPCORE",
> "stack_version": "1.0.0-b96"
> }
> },
> {
> "href":
> "http://c7401.ambari.apache.org:8080/api/v1/stacks/HDPCORE/versions/1.0.0-b96/operating_systems/ubuntu12",
> "OperatingSystems": {
> "os_type": "ubuntu12",
> "stack_name": "HDPCORE",
> "stack_version": "1.0.0-b96"
> }
> }
> ]
> }
> }
> {code}
> This allows us to use the operating system type (like {{redhat7}} or
> {{ubuntu12}}) as a key so we can get more information about the OS:
> {code:title=http://c7401.ambari.apache.org:8080/api/v1/stacks/HDPCORE/versions/1.0.0-b96/operating_systems/redhat7}
> {
> "href":
> "http://c7401.ambari.apache.org:8080/api/v1/stacks/HDPCORE/versions/1.0.0-b96/operating_systems/redhat7?fields=repositories/*",
> "OperatingSystems": {
> "os_type": "redhat7",
> "stack_name": "HDPCORE",
> "stack_version": "1.0.0-b96"
> },
> "repositories": [
> {
> "href":
> "http://c7401.ambari.apache.org:8080/api/v1/stacks/HDPCORE/versions/1.0.0-b96/operating_systems/redhat7/repositories/HDP-UTILS-1.1.0.21",
> "Repositories": {
> "base_url":
> "http://repo.ambari.apache.org/hdpcore/centos7/HDP-UTILS-1.1.0.22/",
> "components": null,
> "default_base_url":
> "http://repo.ambari.apache.org/hdpcore/centos7/HDP-UTILS-1.1.0.22/",
> "distribution": null,
> "mirrors_list": null,
> "os_type": "redhat7",
> "repo_id": "HDP-UTILS-1.1.0.21",
> "repo_name": "HDP-UTILS",
> "stack_name": "HDPCORE",
> "stack_version": "1.0.0-b96",
> "tags": [],
> "unique": false
> }
> },
> {
> "href":
> "http://c7401.ambari.apache.org:8080/api/v1/stacks/HDPCORE/versions/1.0.0-b96/operating_systems/redhat7/repositories/HDPCORE-1.0.0-b96",
> "Repositories": {
> "base_url":
> "http://repo.ambari.apache.org/hdpcore/centos7/HDPCORE-1.0.0-b96",
> "components": null,
> "default_base_url":
> "http://repo.ambari.apache.org/hdpcore/centos7/HDPCORE-1.0.0-b96",
> "distribution": null,
> "mirrors_list": null,
> "os_type": "redhat7",
> "repo_id": "HDPCORE-1.0.0-b96",
> "repo_name": "HDPCORE",
> "stack_name": "HDPCORE",
> "stack_version": "1.0.0-b96",
> "tags": [],
> "unique": false
> }
> }
> ]
> }
> {code}
> This maintains the current structure of {{operating_systems}} being the
> wrapper around each repository. Each {{operating_system}} contains the actual
> repositories:
> {code:title=http://c7001.ambari.apache.org:8080/api/v1/stacks/HDPCORE/versions/1.0.0-b96/operating_systems/redhat7/repositories/HDPCORE-1.0.0-b96}
> {
> "href" :
> "http://c7001.ambari.apache.org:8080/api/v1/stacks/HDPCORE/versions/1.0.0-b96/operating_systems/redhat7/repositories/HDPCORE-1.0.0-b96",
> "Repositories" : {
> "base_url" :
> "http://repo.ambari.apache.org/hdpcore/centos7/HDPCORE-1.0.0-b96",
> "components" : null,
> "default_base_url" :
> "http://repo.ambari.apache.org/hdpcore/centos7/HDPCORE-1.0.0-b96",
> "distribution" : null,
> "mirrors_list" : null,
> "os_type" : "redhat7",
> "repo_id" : "HDPCORE-1.0.0-b96",
> "repo_name" : "HDPCORE",
> "stack_name" : "HDPCORE",
> "stack_version" : "1.0.0-b96",
> "tags" : [ ],
> "unique" : false
> }
> }
> {code}
> - Allows querying by the OS type (not sure if we need or want that)
> - Allows updating all repositories for an OS type in 1 call
> - Requires 1 call per operating system to update all repos
> h5. Scenario 2: Serialized Object without ResourceProvider Support
> The other option is just to serialize the information we have directly as
> part of the mpack endpoint.
> {code:title=http://c7401.ambari.apache.org:8080/api/v1/mpacks/1}
> {
> "href": "http://c7401.ambari.apache.org:8080/api/v1/mpacks/1",
> "MpackInfo": {
> "id": 1,
> "mpack_description": "Hortonworks Data Platform Core",
> "mpack_id": "hdpcore",
> "mpack_name": "HDPCORE",
> "mpack_uri":
> "http://repo.ambari.apache.org/hdpcore/centos7/HDPCORE-1.0.0-b96/mpack.json",
> "mpack_version": "1.0.0-b96",
> "operating_systems": [
> {
> "repositories": [
> {
> "distribution": null,
> "components": null,
> "unique": true,
> "tags": [],
> "base_url":
> "http://repo.ambari.apache.org/hdpcore/centos7/HDPCORE-1.0.0-b96",
> "os_type": "redhat7",
> "repo_id": null,
> "repo_name": null,
> "mirrors_list": null,
> "default_base_url": null,
> "ambari_managed": true
> },
> {
> "distribution": null,
> "components": null,
> "unique": false,
> "tags": [],
> "base_url":
> "http://repo.ambari.apache.org/hdpcore/centos7/HDP-UTILS-1.1.0.22/",
> "os_type": "redhat7",
> "repo_id": null,
> "repo_name": null,
> "mirrors_list": null,
> "default_base_url": null,
> "ambari_managed": true
> }
> ],
> "os_type": "redhat7",
> "ambari_managed": true
> },
> {
> "repositories": [
> {
> "distribution": null,
> "components": null,
> "unique": false,
> "tags": [],
> "base_url":
> "http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/ubuntu12",
> "os_type": "ubuntu12",
> "repo_id": null,
> "repo_name": null,
> "mirrors_list": null,
> "default_base_url": null,
> "ambari_managed": true
> },
> {
> "distribution": null,
> "components": null,
> "unique": true,
> "tags": [],
> "base_url":
> "http://dev.hortonworks.com.s3.amazonaws.com/HDPCORE/ubuntu12/1.x/BUILDS/1.0.0-b96",
> "os_type": "ubuntu12",
> "repo_id": null,
> "repo_name": null,
> "mirrors_list": null,
> "default_base_url": null,
> "ambari_managed": true
> }
> ],
> "os_type": "ubuntu12",
> "ambari_managed": true
> }
> ],
> "registry_id": null,
> "stack_name": "",
> "stack_version": ""
> },
> "operating_system": [],
> "version": []
> }
> {code}
> - Operating systems and repositories are no longer really "resources". You
> can't query by them and can't update them individually
> - Much simpler to implement
> - Requires updating all repos together, but can be done in 1 call
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)