Bug #15644

import_facts assumes orchestration is available

Added by Daniel Lobato Garcia over 1 year ago. Updated about 1 year ago.

Status:Closed
Priority:Normal
Assigned To:Daniel Lobato Garcia
Category:Orchestration
Target version:Team Daniel - iteration 3
Difficulty: Bugzilla link:
Found in release:nightly Pull request:https://github.com/theforeman/foreman/pull/3637
Story points-
Velocity based estimate-
Release1.13.0Release relationshipAuto

Description

Currently (core:develop, discovery:develop) provisioning a discovered host isn't possible. The `import_facts` method assumes there are two methods defined, enable_orchestration! and skip_orchestration! which do not exist for Host::Discovered.

This causes Foreman to throw the following error "undefined method `enable_orchestration!' for #<Host::Discovered:0x005623782265b8>". This is also true when importing facts for a host with :unattended => false

Host::Discovered doesn't need the Orchestration module for anything, however `import_facts` assumes it's there. This should involve two fixes:

1: in discovery, so that it can skip those calls (mocking them or something).
2: in core, so that import_facts doesn't have to rely on anything but Host::Base APIs. It should "know less", and let Host::Managed do these things (enable/skip orchestration) perhaps, as that's where it matters.

The code that causes this error will go in 1.12.1 https://github.com/theforeman/foreman/pull/3574/files#diff-07cbb99bfdb4bed86ad02486bb5adde2R174 so we should hurry up and release a version that fixes the problem. http://projects.theforeman.org/issues/15306


Related issues

Related to Foreman - Bug #15306: Orchestration does not roll back queued actions if DB err... Closed 06/06/2016
Related to Foreman - Bug #17118: Error pushing facts to foreman Duplicate 10/27/2016

Associated revisions

Revision 8cf057c8
Added by Daniel Lobato Garcia over 1 year ago

Fixes #15644 - Move enable/skip_orchestration to Host::Managed

skip_orchestration and enable_orchestration were called in Host::Base
when importing facts. These two methods could not be called there
because they come from the Orchestration mixin which Host::Base does not
have. This blocked importing facts for a Host::Discovered or a Host::Base.

To test this, I've moved the tests that import the facts to a separate
test class just for Host::Base. Notice I've moved a few other tests
which also belong there. There are probably more, but I didn't want to
make this more complicated.

Lastly, Nic::Managed called lookup_value_match on save, so importing
facts didn't work for Host::Base as that method wasn't there either, so
I moved it. Same logic applies to 'setup_clone'.

History

#1 Updated by Daniel Lobato Garcia over 1 year ago

  • Related to Bug #15306: Orchestration does not roll back queued actions if DB error occurs added

#2 Updated by Dominic Cleal over 1 year ago

This is a bug in Foreman if Host::Base assumes a Host::Managed (Orchestration) method exists.

#3 Updated by Daniel Lobato Garcia over 1 year ago

  • Project changed from Discovery to Foreman
  • Category changed from Discovery plugin to Orchestration

Moving to Foreman then

#4 Updated by Dominic Cleal over 1 year ago

  • Release set to 1.12.1

#5 Updated by Dominic Cleal over 1 year ago

  • Found in release set to nightly

#6 Updated by The Foreman Bot over 1 year ago

  • Status changed from New to Ready For Testing
  • Assigned To set to Daniel Lobato Garcia
  • Pull request https://github.com/theforeman/foreman/pull/3637 added

#7 Updated by Dominic Cleal over 1 year ago

  • Release changed from 1.12.1 to 1.13.0

#8 Updated by Daniel Lobato Garcia over 1 year ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#9 Updated by Felix Barbeira about 1 year ago

  • Related to Bug #17118: Error pushing facts to foreman added

#10 Updated by Daniel Lobato Garcia about 1 year ago

  • Target version set to Team Daniel - iteration 3

Also available in: Atom PDF