Skip to content

Commit

Permalink
Fixes #34887 - userdata controller should be able to look up host by …
Browse files Browse the repository at this point in the history
…MAC address
  • Loading branch information
Tilman Kranz authored and Ron-Lavi committed Jun 8, 2022
1 parent 97ec33f commit 46ca3e7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app/controllers/userdata_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ def find_host
ip: request.remote_ip,
}

query_params[:mac_list] = Foreman::UnattendedInstallation::MacListExtractor.new.extract_from_env(request.env, params: params)

@host = Foreman::UnattendedInstallation::HostFinder.new(query_params: query_params).search

return true if @host
Expand Down
4 changes: 2 additions & 2 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,8 @@
# get for all unattended scripts
get 'unattended/(:kind/(:id(:format)))', controller: 'unattended', action: 'host_template', format: 'text'

get 'userdata/meta-data', controller: 'userdata', action: 'metadata', format: 'text'
get 'userdata/user-data', controller: 'userdata', action: 'userdata', format: 'text'
get 'userdata/(:mac)/user-data', controller: 'userdata', action: 'userdata', format: 'text'
get 'userdata/(:mac)/meta-data', controller: 'userdata', action: 'metadata', format: 'text'

resources :tasks, only: [:show]

Expand Down

0 comments on commit 46ca3e7

Please sign in to comment.