Project

General

Profile

Bug #23840

Host class does not change with managed state

Added by Andrew Kofink over 2 years ago. Updated 5 months ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Category:
Host creation
Target version:
-
Difficulty:
easy
Triaged:
Yes
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:

Description

A Host::Base can be a Host::Managed if it's managed? attribute is set. When managed? is false, the host should no longer be a Host::Managed. In nightly, this is not the case.

To reproduce (in rake console):
h = Host.new
h.managed? # false

Actual:
h.class # Host::Managed

Expected:
h.class # Host::Base

This is an issue if we ever want to use polymorphism, and it should be as easy as setting the type correctly on the host. Hopefully, there is no behavior on Host::Managed that shouldn't be there, but if so, it should be moved to Host::Base.

History

#1 Updated by Akshay Mendhe over 2 years ago

  • Assignee set to Akshay Mendhe

#2 Updated by Akshay Mendhe over 2 years ago

Hey Andrew, Just want to know about what should be the default ":type" attribute for newly created host without any parameter, whether it should be Host::Base or Host::Managed, as for now, by default it is Host::Managed.

#3 Updated by Akshay Mendhe over 2 years ago

  • Triaged changed from No to Yes

#4 Updated by Andrew Kofink over 2 years ago

I'm not sure there is a default. It depends on if the host is created as a manged (by puppet) host or not.

#5 Updated by The Foreman Bot over 2 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/6020 added

#6 Updated by Akshay Mendhe over 2 years ago

Yes, so after debugging, I saw that ":managed" boolean attribute is dependent on ":type" attribute but vice-versa is not true. I sent the PR by following the respective condition.

#7 Updated by Tomer Brisker over 1 year ago

  • Assignee deleted (Akshay Mendhe)
  • Status changed from Ready For Testing to New

#8 Updated by Andrew Kofink over 1 year ago

  • Pull request deleted (https://github.com/theforeman/foreman/pull/6020)

The associated PR was abandoned.

#9 Updated by Tomer Brisker 5 months ago

  • Status changed from New to Rejected

It is a bit confusing, but the `managed` flag does not relate to the `Host::Managed` class. There should not be any hosts with `Host::Base` class, as it is a base class for STI, and a `Host::Managed` could either have the `managed` flag set or not.

Also available in: Atom PDF