Project

General

Profile

Bug #4352

Hammer cli cannot update template

Added by Etzion Bar-Noy over 5 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Category:
Foreman commands (obsolete)
Target version:
Difficulty:
Triaged:
Bugzilla link:
Pull request:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

Attempting to use a predefined file (example: discovery-pxe.txt) results in a success, however, the operation doesn't really happen. Below is a sequence of tasks, in the following order:
1. Show discovery-pxe.txt template file
2. Show current template dump (it's template id 2)
3. Import the file to template id 2
4. Show that the current template id 2 dump has not changed

  1. cat /var/share/config-files/discovery-pxe.txt
    <%# This template has special name (do not change it) and it is used for booting unknown hosts. %>

DEFAULT menu
PROMPT 0
MENU TITLE PXE Menu
TIMEOUT 200
TOTALTIMEOUT 6000
DEFAULT menu
PROMPT 0
MENU TITLE PXE Menu
TIMEOUT 200
TOTALTIMEOUT 6000
ONTIMEOUT discovery

LABEL discovery
MENU LABEL Boot Discovery
TEXT HELP
Boot the Foreman Discovery Image
Use TAB to edit options for specific needs.
ENDTEXT
KERNEL /boot/discovery
APPEND initrd=/boot/initrd.gz.1.0.0 foreman.ip=192.168.11.1

  1. hammer template dump --id 2
    <%#
    kind: PXELinux
    name: Community PXE Localboot
    %>

<%# This template has special name (do not change it) and it is used for booting already provisioned hosts. %>

DEFAULT menu
PROMPT 0
MENU TITLE PXE Menu
TIMEOUT 200
TOTALTIMEOUT 6000
ONTIMEOUT local

LABEL local
MENU LABEL (local)
MENU DEFAULT
LOCALBOOT 0

  1. hammer template update --id 2 --file /var/share/config-files/discovery-pxe.txt
    Config template updated
  1. hammer template dump --id 2
    <%#
    kind: PXELinux
    name: Community PXE Localboot
    %>

<%# This template has special name (do not change it) and it is used for booting already provisioned hosts. %>

DEFAULT menu
PROMPT 0
MENU TITLE PXE Menu
TIMEOUT 200
TOTALTIMEOUT 6000
ONTIMEOUT local

LABEL local
MENU LABEL (local)
MENU DEFAULT
LOCALBOOT 0

Associated revisions

Revision d789730c (diff)
Added by Tomas Strachota over 5 years ago

Fixes #4352 - cannot create and update template

Revision ed62cdf3
Added by Tomas Strachota over 5 years ago

Merge pull request #95 from tstrachota/tpl_fix

Fixes #4352 - cannot create and update template

History

#1 Updated by Etzion Bar-Noy over 5 years ago

A note - Centos 6.5, with the latest release version of Foreman and CLI:
  1. rpm -qa | grep foreman
    foreman-installer-1.4.0-1.el6.noarch
    foreman-mysql2-1.4.0-1.el6.noarch
    foreman-release-1.4.0-1.el6.noarch
    foreman-proxy-1.4.0-1.el6.noarch
    rubygem-hammer_cli_foreman-0.0.18-1.el6.noarch
    foreman-1.4.0-1.el6.noarch
    rubygem-foreman_api-0.1.11-1.el6.noarch
  1. rpm -qa | grep hammer
    rubygem-hammer_cli_foreman-0.0.18-1.el6.noarch
    rubygem-hammer_cli-0.0.18-1.el6.noarch

#2 Updated by Dominic Cleal over 5 years ago

  • Project changed from Foreman to Hammer CLI
  • Category set to Foreman commands (obsolete)
  • Legacy Backlogs Release (now unused) deleted (2)

Could you include the output of your hammer update command using "-v"? Also please attach the /var/log/foreman/production.log output while running it.

#3 Updated by Etzion Bar-Noy over 5 years ago

I want to modify the default pxe, so it's id 1, by default. I will continue with it:

hammer -v template update --id 1 --file $BASE/discovery-pxe.txt
Config template updated

From /var/log/foreman/production.log:
Started PUT "/api/config_templates/1" for ::1 at 2014-02-17 09:16:42 +0000
Processing by Api::V2::ConfigTemplatesController#update as JSON
Parameters: {"config_template"=>{}, "apiv"=>"v2", "id"=>"1"}
Authorized user admin(Admin User)
Completed 200 OK in 29ms (Views: 0.3ms | ActiveRecord: 0.0ms)

Versions:
rpm -qa | grep foreman
rubygem-hammer_cli_foreman-0.0.18-1.el6.noarch
foreman-proxy-1.4.0-1.el6.noarch
rubygem-foreman_api-0.1.11-1.el6.noarch
foreman-1.4.0-1.el6.noarch
foreman-cli-1.4.0-1.el6.noarch
foreman-mysql2-1.4.0-1.el6.noarch
foreman-installer-1.4.0-1.el6.noarch

Hammer:
rpm -qa | grep hammer
rubygem-hammer_cli-0.0.18-1.el6.noarch
rubygem-hammer_cli_foreman-0.0.18-1.el6.noarch

#4 Updated by Tomáš Strachota over 5 years ago

  • Status changed from New to Assigned
  • Assignee set to Tomáš Strachota
  • Target version set to 1.9.1

#5 Updated by Dmitri Dolguikh over 5 years ago

  • Target version changed from 1.9.1 to 1.9.0

#6 Updated by Tomáš Strachota over 5 years ago

  • Status changed from Assigned to Ready For Testing

#7 Updated by Tomáš Strachota over 5 years ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF