Project

General

Profile

Actions

Feature #97

closed

Need view for unconfigured hosts

Added by Martin Englund over 14 years ago. Updated over 13 years ago.

Status:
Rejected
Priority:
Normal
Category:
Host creation
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

When you point existing systems to foreman a special view is needed to see which hosts needs to be configured

Actions #2

Updated by Martin Englund over 14 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}

Actions #3

Updated by Ohad Levy over 14 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} }

Actions #4

Updated by Martin Englund over 14 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.

Actions #5

Updated by Ohad Levy over 14 years ago

I think that its possible with named_scope, I'll play with it later on today

Actions #6

Updated by Ohad Levy over 14 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

Actions #7

Updated by Ohad Levy over 14 years ago

any update on this ticket?

thanks

Actions #8

Updated by Ohad Levy over 13 years ago

  • Status changed from New to Rejected
Actions

Also available in: Atom PDF