Project

General

Profile

Actions

Bug #8152

closed

media_path always returns /media

Added by Matteo Cerutti over 9 years ago. Updated almost 7 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
Templates
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Hi,

after upgrading from 1.6.0 to 1.6.1, the <%= media_path %> in my PXELinux templates always return "/media"

I've looked everywhere I seriously cannot understand why this is happening.

This is the dump from the hosts table:

 id  |       name        |       ip       |    last_compile     | last_freshcheck |     last_report     |         updated_at         | source_file_id |         created_at         |        mac        |        
                  root_pass                           | serial | puppet_status | domain_id | architecture_id | operatingsystem_id | environment_id | subnet_id | ptable_id | medium_id | build | comment | disk 
|        installed_at        | model_id | hostgroup_id | owner_id | owner_type | enabled | puppet_ca_proxy_id | managed | use_image | image_file | uuid | compute_resource_id | puppet_proxy_id |     certname  
    | image_id | organization_id | location_id |     type      | compute_profile_id | otp | realm_id | provision_method 
-----+-------------------+----------------+---------------------+-----------------+---------------------+----------------------------+----------------+----------------------------+-------------------+--------
------------------------------------------------------+--------+---------------+-----------+-----------------+--------------------+----------------+-----------+-----------+-----------+-------+---------+------
+----------------------------+----------+--------------+----------+------------+---------+--------------------+---------+-----------+------------+------+---------------------+-----------------+---------------
----+----------+-----------------+-------------+---------------+--------------------+-----+----------+------------------
 200 | test | 192.168.1.2 | 2014-10-28 20:12:07 |                 | 2014-10-28 20:12:02 | 2014-10-29 09:32:58.924234 |                | 2014-10-20 08:01:51.406357 | aa:aa:aa:aa:aa:aa | <secret> |        |   58032402432 |         7 |               1 |                 16 |              7 |        12 |         1 |         1 | f     |         |      
| 2014-10-20 09:38:18.968006 |       16 |              |        4 | User       | t       |                  3 | t       |           |            |      |                     |               3 | test |          |                 |             | Host::Managed |                    |     |          | build
(1 row)

This is the dump from the media table:

 id |      name       |                          path                          |         created_at         |         updated_at         | media_path | config_path | image_path | os_family
1 | CentOS mirror   | http://mirror.centos.org/centos/$major.$minor/os/$arch | 2014-01-17 11:14:04.07884  | 2014-10-28 10:28:46.134152 |            |             |            | Redhat

This is the dump from the operatingsystems table:

 id | major | name | minor | nameindicator |         created_at         |         updated_at         | release_name |  type  | description | hosts_count | hostgroups_count 
----+-------+------+-------+---------------+----------------------------+----------------------------+--------------+--------+-------------+-------------+------------------
 16 | 7     | RHEL | 0     |               | 2014-10-29 08:57:41.793004 | 2014-10-29 08:57:41.793004 |              | Redhat |             |           1 |                0

Dump from media_operatingsystems:

 medium_id | operatingsystem_id 
-----------+--------------------
         1 |                 16

Dump from the template_kinds table:

 id |   name    |         created_at         |         updated_at         
----+-----------+----------------------------+----------------------------
  1 | PXELinux  | 2014-01-17 11:14:06.360278 | 2014-01-17 11:14:06.360278
  3 | provision | 2014-01-17 11:14:06.366739 | 2014-01-17 11:14:06.366739
  4 | finish    | 2014-01-17 11:14:06.369541 | 2014-01-17 11:14:06.369541
  5 | script    | 2014-01-17 11:14:06.37238  | 2014-01-17 11:14:06.37238
  6 | PXEGrub   | 2014-01-17 11:14:07.339173 | 2014-01-17 11:14:07.339173
  2 | iPXE      | 2014-01-17 11:14:06.36404  | 2014-02-10 16:23:30.818094

Dump from the config_templates_operatingsystems:

 config_template_id | operatingsystem_id 
--------------------+--------------------
                 32 |                 16

Dump from the os_default_templates:

 id | config_template_id | template_kind_id | operatingsystem_id |         created_at         |         updated_at         
----+--------------------+------------------+--------------------+----------------------------+----------------------------
 25 |                 32 |                1 |                 16 | 2014-10-29 09:51:07.265954 | 2014-10-29 09:51:07.265954

I've enabled DEBUG mode and this is the SQL query being executed:

foreman=> SELECT config_templates.* FROM config_templates INNER JOIN config_templates_operatingsystems ON config_templates_operatingsystems.config_template_id = config_templates.id INNER JOIN operatingsystems ON operatingsystems.id = config_templates_operatingsystems.operatingsystem_id INNER JOIN template_kinds ON template_kinds.id = config_templates.template_kind_id INNER JOIN os_default_templates ON os_default_templates.config_template_id = config_templates.id WHERE template_kinds.name = 'PXELinux' AND operatingsystems.id = 16 AND os_default_templates.operatingsystem_id = 16 ORDER BY config_templates.name LIMIT 1;
 id | name |     template      | snippet | template_kind_id |         created_at         |         updated_at         | locked | default | vendor 
----+------+-------------------+---------+------------------+----------------------------+----------------------------+--------+---------+--------
 32 | test | <%= media_path %>+| f       |                1 | 2014-10-29 08:57:09.296679 | 2014-10-29 10:06:30.423036 | f      | f       | 
    |      | <%= @mediapath %> |         |                  |                            |                            |        |         | 

The query returns the template indeed, but then when I preview it, <%= media_path %> returns /media.

Can anyone shade some light as per why this is happening?

Thanks,
Matteo

Actions #1

Updated by Dominic Cleal over 9 years ago

  • Category set to Templates

I think this is only when previewing a template, as in that case it goes through the UnattendedController which has a different setup for rendering templates. When you click Build, it's instead rendered entirely inside Host::Managed (via a combination of Orchestration::TFTP, Foreman::Renderer and HostTemplateHelpers).

Actions #2

Updated by Dominic Cleal over 9 years ago

  • Description updated (diff)
Actions #3

Updated by Matteo Cerutti over 9 years ago

Dominic,

I see, it's indeed like that. However, I used to be able to review it without actually starting a build process. Never mind )

Thank you!
Matteo

Actions #4

Updated by Anonymous almost 7 years ago

  • Status changed from New to Resolved

should be solved by now anyway

Actions

Also available in: Atom PDF