while (serviceDefIterator.hasNext() || hueService != null) {
ApiServiceList serviceList = new ApiServiceList();
try {
if (hueService != null) {
CmServiceDef hdfsService = cluster.serviceDefOfType("HDFS");
CmRoleDef namenodeRole = null;
for (CmRoleDef roleDef : hdfsService.getRoles()) {
if (roleDef.getType().getDisplayName().equals("HDFS_NAMENODE")) {
namenodeRole = roleDef;
break;
}
}
if (namenodeRole != null) {
// namenode role def should already synced the role ID from CM
hueService.addConfig(Constants.CONFIG_HUE__WEBHDFS, namenodeRole.getName());
addApiService(serviceList, cluster, hueService, servicesConfigured);
}
hueService = null;
}