Project

General

Profile

Actions

Bug #34404

closed

hammer host interface update does not update remote execution setting

Added by Adam Ruzicka almost 3 years ago. Updated about 2 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
Category:
CLI
Target version:
-
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=2009398

Description of problem:

hammer host interface update --host myhost.example.com --execution false --interface-id 17

does not change remote execution setting

Version-Release number of selected component (if applicable):

6.9.6.1

How reproducible:

100%

Steps to Reproduce:
1.

#hammer p RedHat1! host interface list --host myhost.example.com
--
|------------|-------------------------------------------|-------------------|--------------|-----------------------------
ID | IDENTIFIER | TYPE | MAC ADDRESS | IP ADDRESS | DNS NAME
---|------------|-------------------------------------------|-------------------|--------------|-----------------------------
18 | | interface | 52:54:00:20:2d:1e | 172.16.0.231 |
17 | ens3 | interface (primary, provision, execution) | 52:54:00:7a:e0:22 | 172.16.0.139 | myhost.example.com
20 | | base | | |
21 | | base | | |
---|------------|-------------------------------------------|-------------------|--------------|-----------------------------

2.

#hammer host interface update --host myhost.example.com --execution false --interface-id 17
Interface updated.

3.
#hammer p RedHat1! host interface list --host myhost.example.com
--
|------------|-------------------------------------------|-------------------|--------------|-----------------------------
ID | IDENTIFIER | TYPE | MAC ADDRESS | IP ADDRESS | DNS NAME
---|------------|-------------------------------------------|-------------------|--------------|-----------------------------
18 | | interface | 52:54:00:20:2d:1e | 172.16.0.231 |
17 | ens3 | interface (primary, provision, execution) | 52:54:00:7a:e0:22 | 172.16.0.139 | myhost.example.com
20 | | base | | |
21 | | base | | |
---|------------|-------------------------------------------|-------------------|--------------|-----------------------------

Actual results:

interface not updated

Expected results:

interface setting updated

Additional info:


Related issues 1 (0 open1 closed)

Related to Foreman Remote Execution - Bug #34452: Allow host not having an execution interfaceClosedAdam RuzickaActions
Actions #1

Updated by Adam Ruzicka almost 3 years ago

  • Assignee set to Adam Ruzicka

Remote execution has some checks that enforce that a host:
1) does not have more than 1 execution interface
2) If the host does not have an execution interface, the primary interface becomes the execution interface

For example let's take this host

# hammer host interface list --host flowing-escargot.example.com 
---|------------|-------------------------------------------|-------------------|-----------------|-----------------------------
ID | IDENTIFIER | TYPE                                      | MAC ADDRESS       | IP ADDRESS      | DNS NAME                    
---|------------|-------------------------------------------|-------------------|-----------------|-----------------------------
2  | eth0       | interface (primary, provision, execution) | 00:16:3e:10:8e:84 | 192.168.125.181 | flowing-escargot.example.com
3  | lo         | interface                                 |                   | 127.0.0.1       | localhost                   
---|------------|-------------------------------------------|-------------------|-----------------|-----------------------------

If I try to set lo to be the execution interface, it fails because eth0 is already an execution interface (see 1). If I try to unset eth0 as execution interface, it will immediately get re-marked as execution because it is also a primary interface.

As a workaround, we can perform both changes at once with curl

# cat <<EOF >/tmp/json
{"host": {
  "interfaces_attributes": [
    {"id": 2, "execution": false},
    {"id": 3, "execution": true}
  ]
}}
EOF

# curl -X PUT https://$SAT_FQDN/api/hosts/$HOST_ID -H 'Content-Type: application/json' -u $USER:$PASS -d @/tmp/json
-----B<-----SNIP-----B<-----

# hammer host interface list --host flowing-escargot.example.com 
---|------------|--------------------------------|-------------------|-----------------|-----------------------------
ID | IDENTIFIER | TYPE                           | MAC ADDRESS       | IP ADDRESS      | DNS NAME                    
---|------------|--------------------------------|-------------------|-----------------|-----------------------------
2  | eth0       | interface (primary, provision) | 00:16:3e:10:8e:84 | 192.168.125.181 | flowing-escargot.example.com
3  | lo         | interface (execution)          |                   | 127.0.0.1       | localhost                   
---|------------|--------------------------------|-------------------|-----------------|-----------------------------

I don't think this is currently doable with hammer.

From how I see it, we have 3 options:
1) Learn hammer to set other interfaces to execution=false when execution=true is being set for an interface
2) Make the change on Foreman's side (when execution flag is being set on an interface, remove it from all other interfaces of the same host)
3) Learn hammer to take parameters for multiple interfaces at once, something along the lines of hammer host interface update --host flowing-escargot.example.com --id 2 --execution false --id 3 --execution true

Actions #2

Updated by Adam Ruzicka almost 3 years ago

  • Project changed from Hammer CLI to Foreman Remote Execution
  • Category set to CLI
Actions #3

Updated by The Foreman Bot almost 3 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/hammer_cli_foreman_remote_execution/pull/43 added
Actions #4

Updated by Ondřej Ezr almost 3 years ago

  • Bugzilla link deleted (2009398)

Proper fix for this is in #34452

Actions #5

Updated by Ondřej Ezr almost 3 years ago

  • Related to Bug #34452: Allow host not having an execution interface added
Actions #6

Updated by Adam Ruzicka about 2 years ago

  • Status changed from Ready For Testing to Rejected

This got fixed in foreman_remote_execution itself.

Actions

Also available in: Atom PDF