Skip to content
This repository has been archived by the owner on Jan 15, 2019. It is now read-only.

Commit

Permalink
Revert removal of iterative check for partial_hosts in show_hostgroup…
Browse files Browse the repository at this point in the history
…_overview

refs #1013
  • Loading branch information
mjbrooks committed Jul 29, 2011
1 parent 580a0ab commit 75b9029
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions cgi/status.c
Expand Up @@ -3768,11 +3768,46 @@ void show_hostgroup_overview(hostgroup *hstgrp){
hoststatus *temp_hoststatus=NULL;
int odd=0;
int json_start=TRUE;
int partial_hosts=FALSE;

/* make sure the user is authorized to view this hostgroup */
if(show_partial_hostgroups==FALSE && is_authorized_for_hostgroup(hstgrp,&current_authdata)==FALSE)
return;

/* if we're showing partial hostgroups, find out if there will be any hosts that belong to the hostgroup */
if(show_partial_hostgroups==TRUE) {
for(temp_member=hstgrp->members;temp_member!=NULL;temp_member=temp_member->next){

/* find the host... */
temp_host=find_host(temp_member->host_name);
if(temp_host==NULL)
continue;

/* only shown in partial hostgroups if user is authorized to view this host */
if (is_authorized_for_host(temp_host,&current_authdata)==FALSE)
continue;

/* find the host status */
temp_hoststatus=find_hoststatus(temp_host->name);
if(temp_hoststatus==NULL)
continue;

/* make sure we will only be displaying hosts of the specified status levels */
if(!(host_status_types & temp_hoststatus->status))
continue;

/* make sure we will only be displaying hosts that have the desired properties */
if(passes_host_properties_filter(temp_hoststatus)==FALSE)
continue;

partial_hosts=TRUE;
}
}

/* if we're showing partial hostgroups, but there are no hosts to display, there's nothing to see here */
if(show_partial_hostgroups==TRUE && partial_hosts==FALSE)
return;

/* print json format */
if(content_type==JSON_CONTENT) {
printf("{ \"hostgroup_name\": \"%s\",\n",json_encode(hstgrp->group_name));
Expand Down

0 comments on commit 75b9029

Please sign in to comment.