<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question configure Service Auto Start Configuration by API in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/configure-Service-Auto-Start-Configuration-by-API/m-p/177011#M67695</link>
    <description>&lt;P&gt;I  do  the following API in order to enable all services in ambari cluster to start automatically on system&lt;/P&gt;&lt;P&gt;first I collect all components:&lt;/P&gt;&lt;P&gt; list_of_all_components=` curl -H "X-Requested-By: ambari" -u admin:admin -X GET "http://localhost:8080/api/v1/clusters/HDP01/components?fields=ServiceComponentInf/component_name,ServiceComponentInfo/service_name,ServiceComponentInfo/categoy,ServiceComponentInfo/recovery_enabled,ServiceComponentInfo/total_count&amp;amp;minimal_response=true"  | grep component_name | sed s'/"//g' | sed s'/,//g' | awk '{print $NF}'  ` &lt;/P&gt;&lt;P&gt;then I add the field separator "," &lt;/P&gt;&lt;P&gt;LIST=` echo $list_of_all_components  | sed s'/ /,/g' `&lt;/P&gt;&lt;P&gt;and I defined the variable - $LIST inside the following API&lt;/P&gt;&lt;P&gt;  curl -H "X-Requested-By: ambari" -u admin:admin -X PUT -d '{"RequestInfo":{"query":"ServiceComponentInfo/component_name.in($LIST)"},"ServiceComponentInfo":{"recovery_enabled":"true"}}'  &lt;A href="http://localhost:8080/api/v1/clusters/HDP01/components" target="_blank"&gt;http://localhost:8080/api/v1/clusters/HDP01/components&lt;/A&gt;?&lt;/P&gt;&lt;P&gt;what is wrong with this , why API not accepted the variable - $LIST&lt;/P&gt;&lt;P&gt;
{
  "status" : 500,
  "message" : "org.apache.ambari.server.controller.spi.SystemException: An internal system exception occurred: Could not find service for component, componentName=$LIST, clusterName=HDP01, stackInfo=HDP-2.6"&lt;/P&gt;&lt;P&gt;remark - the answer - &lt;A href="https://community.hortonworks.com/questions/135367/service-auto-start-configuration-by-api.html" target="_blank"&gt;https://community.hortonworks.com/questions/135367/service-auto-start-configuration-by-api.html&lt;/A&gt; , is the same solution but have the real names components , what we want is to add the variable $LIST insted the real componets name &lt;/P&gt;</description>
    <pubDate>Wed, 06 Sep 2017 21:48:15 GMT</pubDate>
    <dc:creator>mike_bronson7</dc:creator>
    <dc:date>2017-09-06T21:48:15Z</dc:date>
    <item>
      <title>configure Service Auto Start Configuration by API</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/configure-Service-Auto-Start-Configuration-by-API/m-p/177011#M67695</link>
      <description>&lt;P&gt;I  do  the following API in order to enable all services in ambari cluster to start automatically on system&lt;/P&gt;&lt;P&gt;first I collect all components:&lt;/P&gt;&lt;P&gt; list_of_all_components=` curl -H "X-Requested-By: ambari" -u admin:admin -X GET "http://localhost:8080/api/v1/clusters/HDP01/components?fields=ServiceComponentInf/component_name,ServiceComponentInfo/service_name,ServiceComponentInfo/categoy,ServiceComponentInfo/recovery_enabled,ServiceComponentInfo/total_count&amp;amp;minimal_response=true"  | grep component_name | sed s'/"//g' | sed s'/,//g' | awk '{print $NF}'  ` &lt;/P&gt;&lt;P&gt;then I add the field separator "," &lt;/P&gt;&lt;P&gt;LIST=` echo $list_of_all_components  | sed s'/ /,/g' `&lt;/P&gt;&lt;P&gt;and I defined the variable - $LIST inside the following API&lt;/P&gt;&lt;P&gt;  curl -H "X-Requested-By: ambari" -u admin:admin -X PUT -d '{"RequestInfo":{"query":"ServiceComponentInfo/component_name.in($LIST)"},"ServiceComponentInfo":{"recovery_enabled":"true"}}'  &lt;A href="http://localhost:8080/api/v1/clusters/HDP01/components" target="_blank"&gt;http://localhost:8080/api/v1/clusters/HDP01/components&lt;/A&gt;?&lt;/P&gt;&lt;P&gt;what is wrong with this , why API not accepted the variable - $LIST&lt;/P&gt;&lt;P&gt;
{
  "status" : 500,
  "message" : "org.apache.ambari.server.controller.spi.SystemException: An internal system exception occurred: Could not find service for component, componentName=$LIST, clusterName=HDP01, stackInfo=HDP-2.6"&lt;/P&gt;&lt;P&gt;remark - the answer - &lt;A href="https://community.hortonworks.com/questions/135367/service-auto-start-configuration-by-api.html" target="_blank"&gt;https://community.hortonworks.com/questions/135367/service-auto-start-configuration-by-api.html&lt;/A&gt; , is the same solution but have the real names components , what we want is to add the variable $LIST insted the real componets name &lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2017 21:48:15 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/configure-Service-Auto-Start-Configuration-by-API/m-p/177011#M67695</guid>
      <dc:creator>mike_bronson7</dc:creator>
      <dc:date>2017-09-06T21:48:15Z</dc:date>
    </item>
    <item>
      <title>Re: configure Service Auto Start Configuration by API</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/configure-Service-Auto-Start-Configuration-by-API/m-p/177012#M67696</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/26229/uribarih.html" nodeid="26229"&gt;@uri ben-ari&lt;/A&gt;&lt;P&gt;Please try the curl command with double quotes (escaping the double quotes needed as part of curl rrequest)&lt;/P&gt;&lt;P&gt;curl -H "X-Requested-By: ambari" -u admin:admin -X PUT -d "{\"RequestInfo\":{\"query\":\"ServiceComponentInfo/component_name.in(${LIST})\"},\"ServiceComponentInfo\":{\"recovery_enabled\":\"true\"}}"  &lt;A href="http://localhost:8080/api/v1/clusters/HDP01/components" target="_blank"&gt;http://localhost:8080/api/v1/clusters/HDP01/components&lt;/A&gt;?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2017 06:23:23 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/configure-Service-Auto-Start-Configuration-by-API/m-p/177012#M67696</guid>
      <dc:creator>rchoksi</dc:creator>
      <dc:date>2017-09-07T06:23:23Z</dc:date>
    </item>
  </channel>
</rss>

