Feature #97
Need view for unconfigured hosts
| Status: | Rejected | Start: | 11/27/2009 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assigned to: | % Done: | 0% |
||
| Category: | Host creation | |||
| Target version: | - | |||
| Backlog: | Difficulity: | |||
| Votes: | 0 |
Description
When you point existing systems to foreman a special view is needed to see which hosts needs to be configured
History
Updated by Martin Englund over 2 years ago
Updated by Martin Englund over 2 years ago
How do you add a constraint on a join table in active_scaffold? Currently it does this, which is simple:
:constraints => { :hostgroup_id => nil}
Updated by Ohad Levy over 2 years ago
Martin Englund wrote:
How do you add a constraint on a join table in active_scaffold? Currently it does this, which is simple: [...]
try:
:constraints => { :host => { :puppetclasses => nil} }
Updated by Martin Englund over 2 years ago
Ohad Levy wrote:
try: :constraints => { :host => { :puppetclasses => nil} }
That generates a SQL query with a WHERE clause like this:
WHERE hosts_puppetclasses.puppetclass_id IS NULL
which is always going to return an empty list.
I think I'll have to create a custom SQL query to pick out the host.id for unconfigured hosts, and then pass it to the active_scaffold constraints clause.
Updated by Ohad Levy over 2 years ago
I think that its possible with named_scope, I'll play with it later on today
Updated by Ohad Levy over 2 years ago
Ohad Levy wrote:
I think that its possible with named_scope, I'll play with it later on today
one option would be do to something like this:
#all hosts which have no classes defined:
named_scope :classless, :include => :puppetclasses, :conditions => {'hosts_puppetclasses.host_id' => nil }
#all hosts which do not belong to a group
named_scope :groupless, :include => :hostgroup, :conditions => { 'hostgroups.id' => nil }
than you could play with it - e.g.:
Host.classless.groupless > all hosts which are unconfigured
Host.classless.groupless.count > count all hosts which are unconfigured in an SQL friendly way.
Hopes this helps
Updated by Ohad Levy over 1 year ago
- Status changed from New to Rejected
