I've never seem a component call Ambari, technically it''s possible but you would have the issue of having to provide (and keep up to date) admin user credentials. I think Ambari Views do something like that when managing an external cluster because you have to enter url and user/password when you create the view.
I haven't found any public documentation on building Ambari components other than a few examples. What I do is look at the Ambari source code and learn from the existing HDP stack services. On 5 October 2017 at 17:27, Markovich <[email protected]> wrote: > Ok, got this. Will try with Slave... > > One more question: is it possible execute Ambari REST API call from custom > service script? May be there is ambari client (or someting like that) > in resource_management lib? > > Also is there any documentation on all functions avaliable for custom > scripts in python? > > Regards, > Andrey > > 2017-10-05 18:26 GMT+03:00 Gonzalo Herreros <[email protected]>: > >> "CLIENT" category components are meant to be just libraries without any >> actions. >> Have you tried with a "SLAVE" component?, it would be a bit odd but you >> don't really need to run any process >> >> On 5 October 2017 at 15:27, Markovich <[email protected]> wrote: >> >>> Hi Gonzalo, >>> >>> Thank you for answers. >>> >>> The custom action is not just shell command. I need to add custom action >>> to ambari Service page but for client roles (components). >>> I know how to do it for Master component, but same function is not >>> beeing triggered for Client. >>> >>> Regards, >>> Andrey >>> >>> 2017-10-05 17:16 GMT+03:00 Gonzalo Herreros <[email protected]>: >>> >>>> 1) By custom action I guess you mean a shell command, example: >>>> from resource_management import Execute >>>> Execute("mkdir /var/lib/mydir") >>>> >>>> Typically you would put that in the "install" or "start" method of your >>>> component script that extends: from resource_management import Script >>>> >>>> 2) AFAIK there is no "uninstall" callback you can implement. >>>> You could do some cleanup every time you stop the service (assuming it >>>> doesn't take long to recreate on start) since to delete it you need to stop >>>> it first. >>>> Ambari doesn't have a tradition of cleaning up things on deletion >>>> >>>> Regards, >>>> Gonzalo >>>> >>>> >>>> On 5 October 2017 at 14:33, Markovich <[email protected]> wrote: >>>> >>>>> Hello ambari users! >>>>> >>>>> I've got two questions about implementing custom service. >>>>> Here they are: >>>>> 1) How to execute custom action on client host? >>>>> 2) Is it possible to runs some code on host before deleting the >>>>> service (for example some cleanup)? >>>>> >>>>> Thanks for your time. >>>>> >>>>> Regards, >>>>> Andrey >>>>> >>>> >>>> >>> >> >
