func (c *Client) Remove(id string) error {
	sudo := "sudo"
	if c.noSudo {
		sudo = ""
	}

	removeCmd := strings.TrimSpace(
		fmt.Sprintf(
			"%s %s -r %s",
			sudo,
			c.manageExec,
			id,
		),
	)

	s, err := c.run(removeCmd)
	if err != nil {
		return fmt.Errorf("failed to remove the host: %v", err)
	}

	agent, err := c.Find("id", id)
	if err != nil {
		return err
	}

	if agent != nil {
		return fmt.Errorf("agent was not removed: %s", s)
	}

	return nil
}
// Remove removes a host from ossec
Remove removes a host from ossec
// Remove removes a host from ossec
func (c *Client) Remove(id string) error {
	sudo := "sudo"
	if c.noSudo {
		sudo = ""
	}
	removeCmd := strings.TrimSpace(
		fmt.Sprintf(
			"%s %s -r %s",
			sudo,
			c.manageExec,
			id,
		),
	)
	s, err := c.run(removeCmd)
	if err != nil {
		return fmt.Errorf("failed to remove the host: %v", err)
	}
	agent, err := c.Find("id", id)
	if err != nil {
		return err
	}
	if agent != nil {
		return fmt.Errorf("agent was not removed: %s", s)
	}
	return nil
}
func ( c * Client ) Remove ( id string ) error { sudo := " " if c . noSudo { sudo = " " } removeCmd := strings . TrimSpace ( fmt . Sprintf ( " " , sudo , c . manageExec , id , ) , ) s , err := c . run ( removeCmd ) if err != nil { return fmt . Errorf ( " " , err ) } agent , err := c . Find ( " " , id ) if err != nil { return err } if agent != nil { return fmt . Errorf ( " " , s ) } return nil }
Remove removes a host from ossec
Remove removes a host from ossec