Reply
Expert Contributor
Posts: 139
Registered: ‎07-21-2014

Apply host template - Host must have a single version of CDH installed

While attempting to apply a host template, I keep running into this error/notification:

 

Host must have a single version of CDH installed

 

I didn't notice multiple cm agents running on the host, is there anything else I need to check?

 

Thanks! 

New Contributor
Posts: 3
Registered: ‎10-18-2017

Re: Apply host template - Host must have a single version of CDH installed

Hi buntu,

Apart from having the CM Agent service running - did you send a parcel to the host? (This is done by Adding to cluster)
Below API endpoint should be called with POST

/clusters/{{ cluster }}/hosts

 and payload:

{'items': ['my_node_fqdn', 'other_node_fqdn'] }

Hopes this helps others.

Explorer
Posts: 10
Registered: ‎06-19-2018

Re: Apply host template - Host must have a single version of CDH installed

Hello,

 

In my case, I'm trying to deploy a new host with Cloudera CM Api (suing Python). All runs good, but when I want to apply a host template, I'm receiving this error:

 

ApiException: Host must have a single version of CDH installed. (error 400)

 

I know that Cloudera automatically dsitribute and activate parcels to new host, but how can I do, in teh same code, to recognize that the activation completes and then run apply host template?

 

Parcel state is Activated when running, despite of is in distribution state.

Explorer
Posts: 10
Registered: ‎06-19-2018

Re: Apply host template - Host must have a single version of CDH installed

[ Edited ]

This is my code:

 

from cm_api.api_client import ApiResource, ApiException
from time import sleep
import ssl
from time import gmtime, strftime
import socket

 

repo_url='https://archive.cloudera.com/cm5/redhat/7/x86_64/cm/5.15.1/'
hostnames = ["clouderapre-node3"]
hosts = []
host_password='cloudera'
parcel_version = "5.15.0-1.cdh5.15.0.p0.21"

 


CM_SERVER_HOST="clouderapre-mgr.fintonic.com"
cxt = ssl.create_default_context(cafile="/home/rlopez/certs/CA.crt.pem")
api = ApiResource(CM_SERVER_HOST, username="cmapi", password="B1gd4t@", use_tls=True, ssl_context=cxt)
cm = api.get_cloudera_manager()
cluster = api.get_cluster('cluster')
parcel = cluster.get_parcel('CDH', parcel_version)
template = cluster.get_host_template(name='nodo-computo')

 

for hostname in hostnames:
     create_host = api.create_host(hostname, hostname, socket.gethostbyname(hostname), "/default")
     hosts.append(create_host)
     install_cm_agent = cm.host_install(user_name='root', host_names=[hostname], cm_repo_url=repo_url,       password=host_password, )
     while install_cm_agent.success == None:
         sleep(5)
         install_cm_agent = install_cm_agent.fetch()

     if install_cm_agent.success != True:
         print "cm_host_install failed: " + install_cm_agent.resultMessage
         exit(0)

sleep(60)

 

for host in hosts:
     hostId = [host.hostId]
     add_host = cluster.add_hosts(hostId)
     install_template = template.apply_host_template(host_ids=hostId, start_roles=True)
     while install_template.resultMessage == "ApiException: Host must have a single version of CDH installed. (error 400)":
         sleep(5)
         install_template = template.apply_host_template(host_ids=hostId, start_roles=True).wait()
         exit(0)

New Contributor
Posts: 2
Registered: ‎11-23-2018

Re: Apply host template - Host must have a single version of CDH installed

Facing similar issue, did you get any solution yet?

 

Regards,

Smith

New Contributor
Posts: 1
Registered: ‎06-28-2018

Re: Apply host template - Host must have a single version of CDH installed

Hi, Do you have a solution for this?