Hi,
I have cm_api scripts that create a multinode cdh cluster, which is working
fine.
I have another script that adds new hosts to the cluster and apply a
template, but this fails with the below error. Not sure if I am missing
something.
Note: From the UI I can apply the same template to the host and it works
fine, but not from the cm_api
datanode_template = None
try:
datanode_template = cluster.get_host_template(template_name)
except ApiException, ex:
LOG.critical('No template by name %s found. Please verify the
template name' %(template_name))
raise(ex)
cmd = datanode_template.apply_host_template(host_ids=host_list,
start_roles=False) # Fails here
if not cmd.wait(CM_START_TIMEOUT).success:
LOG.warn('Failed to apply template to datanodes')
LOG.warn('Command message: %s' %(cmd.resultMessage))
else:
LOG.info('Template %s applied to datanodes sucessfully and started'%(template_name))
Exception message on the console:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/fabric/main.py", line 743, in main
*args, **kwargs
File "/Library/Python/2.7/site-packages/fabric/tasks.py", line 368, in
execute
multiprocessing
File "/Library/Python/2.7/site-packages/fabric/tasks.py", line 264, in
_execute
return task.run(*args, **kwargs)
File "/Library/Python/2.7/site-packages/fabric/tasks.py", line 171, in run
return self.wrapped(*args, **kwargs)
File "/Library/Python/2.7/site-packages/fabric/decorators.py", line 53,
in inner_decorator
return func(*args, **kwargs)
File "/Users/vbajaj/work/cloudera/cdh-configurator/AddDataNodes.py", line
105, in add_datanodes
CreateCdhCluster.add_data_nodes(cluster, dn_template_name, data_nodes)
File
"/Users/vbajaj/work/cloudera/cdh-configurator/cm_client/CreateCdhCluster.py",
line 49, in add_data_nodes
cmd = datanode_template.apply_host_template(host_ids=host_list,
start_roles=False)
File
"/Library/Python/2.7/site-packages/cm_api/endpoints/host_templates.py",
line 160, in apply_host_template
return apply_host_template(self._get_resource_root(), self.name,
self.clusterRef.clusterName, host_ids, start_roles)
File
"/Library/Python/2.7/site-packages/cm_api/endpoints/host_templates.py",
line 105, in apply_host_template
resp = resource_root.post(APPLY_HOST_TEMPLATE_PATH % (cluster_name,
name), params=params, data=body)
File "/Library/Python/2.7/site-packages/cm_api/resource.py", line 116, in
post
self._make_headers(contenttype))
File "/Library/Python/2.7/site-packages/cm_api/resource.py", line 58, in
invoke
headers=headers)
File "/Library/Python/2.7/site-packages/cm_api/http_client.py", line 161,
in execute
raise self._exc_class(ex)
cm_api.api_client.ApiException: Host must have a single version of CDH
installed. (error 400)
Exception in the scm server log
POST
/api/v5/clusters/cdh-dev-cluster/hostTemplates/Datanode-Template-1/commands/applyHostTemplate?startRoles=False
Encoding: UTF-8
Authentication: admin [FEATURE_KERBEROS, ROLE_ADMIN, ROLE_USER]
Headers:
accept-encoding=[identity]
connection=[close]
Content-Length=[54]
content-type=[application/json]
Cookie=[CLOUDERA_MANAGER_SESSIONID=8qixdycf6kuebs7ab4fzh3ax]
Host=[cm01-dev.my.domain.com:7180]
User-Agent=[Python-urllib/2.7]
Body:
{"items": [{"hostId": "cdh06-dev.my.domain.com"}]}
2014-02-21 23:51:58,736 DEBUG
[362553707@scm-web-86:api.ApiExceptionMapper@143] Exception caught in API
invocation.
java.lang.IllegalArgumentException: Host must have a single version of CDH
installed.
at
com.cloudera.server.cmf.hosttemplate.components.HostTemplateManagerImpl.applyHostTemplate(HostTemplateManagerImpl.java:332)
at
com.cloudera.api.dao.impl.HostTemplateManagerDaoImpl.applyHostTemplate(HostTemplateManagerDaoImpl.java:148)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at
com.cloudera.api.dao.impl.ManagerDaoBase.runInNewTransaction(ManagerDaoBase.java:147)
at com.cloudera.api.dao.impl.ManagerDaoBase.invoke(ManagerDaoBase.java:192)
at com.sun.proxy.$Proxy94.applyHostTemplate(Unknown Source)
at
com.cloudera.api.v3.impl.HostTemplateResourceImpl.applyHostTemplate(HostTemplateResourceImpl.java:73)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at
org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:173)
at
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:89)
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:167)
at com.cloudera.api.ApiInvoker.invoke(ApiInvoker.java:102)
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:243)
at com.cloudera.api.ApiInvoker.invoke(ApiInvoker.java:102)
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:243)
at com.cloudera.api.ApiInvoker.invoke(ApiInvoker.java:102)
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:243)
at com.cloudera.api.ApiInvoker.invoke(ApiInvoker.java:102)
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:94)
at
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
at
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:122)
at
org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:207)
at
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:213)
at
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:154)
at
org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:129)
at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:219)
at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:139)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:195)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1221)
at
com.cloudera.enterprise.JavaMelodyFacade$MonitoringFilter.doFilter(JavaMelodyFacade.java:109)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)
at
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
at
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at
org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at
org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:101)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at
org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at
org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at
org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at
org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at com.cloudera.api.ApiBasicAuthFilter.doFilter(ApiBasicAuthFilter.java:37)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)
at
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
at
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
at
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at
org.mortbay.jetty.handler.StatisticsHandler.handle(StatisticsHandler.java:53)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at
org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
at
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
2014-02-21 23:51:58,738 DEBUG [362553707@scm-web-86:api.ApiInvoker@123] API
Error 400
[/api/v5/clusters/cdh-dev-cluster/hostTemplates/Datanode-Template-1/commands/applyHostTemplate]:
ApiErrorMessage{Host must have a single version of CDH installed.}
2014-02-21 23:51:58,738 DEBUG [362553707@scm-web-86:api.ApiInvoker@123] API
Error 400
[/api/v5/clusters/cdh-dev-cluster/hostTemplates/Datanode-Template-1/commands/applyHostTemplate]:
ApiErrorMessage{Host must have a single version of CDH installed.}
2014-02-21 23:51:58,739 DEBUG [362553707@scm-web-86:api.ApiInvoker@123] API
Error 400
[/api/v5/clusters/cdh-dev-cluster/hostTemplates/Datanode-Template-1/commands/applyHostTemplate]:
ApiErrorMessage{Host must have a single version of CDH installed.}
2014-02-21 23:51:58,739 DEBUG [362553707@scm-web-86:api.ApiInvoker@123] API
Error 400
[/api/v5/clusters/cdh-dev-cluster/hostTemplates/Datanode-Template-1/commands/applyHostTemplate]:
ApiErrorMessage{Host must have a single version of CDH installed.}
2014-02-21 23:51:58,740 DEBUG
[362553707@scm-web-86:api.LoggingOutInterceptor@101] API response:
---------- id: 28
Response code: 400
Content-Type: application/json
Headers:
Content-Type=[application/json]
Date=[Fri, 21 Feb 2014 23:51:58 GMT]
Body:
{
"message" : "Host must have a single version of CDH installed."
}
Any clue?
To unsubscribe from this group and stop receiving emails from it, send an email to scm-users+unsubscribe@cloudera.org.