Project

General

Profile

Bug #8152

Updated by Dominic Cleal about 10 years ago

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: 
 <pre> 
  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) 
 </pre> 

 This is the dump from the media table: 
 <pre> 
  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 
 </pre> 

 This is the dump from the operatingsystems table: 
 <pre> 
  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 
 </pre> 

 Dump from media_operatingsystems: 
 <pre> <pre 
  medium_id | operatingsystem_id  
 -----------+-------------------- 
          1 |                   16 
 </pre> 

 Dump from the template_kinds table: 
 <pre> 
  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 
 </pre> 

 Dump from the config_templates_operatingsystems: 
 <pre> 
  config_template_id | operatingsystem_id  
 --------------------+-------------------- 
                  32 |                   16 
 </pre> 

 Dump from the os_default_templates: 
 <pre> 
  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 
 </pre> 

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

 <pre> 
 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 %> |           |                    |                              |                              |          |           |  
 </pre> 

 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

Back