Bug #4232

Can not create template using hammer (hammer template create)

Added by Petr Ruzicka almost 4 years ago. Updated over 3 years ago.

Status:Closed
Priority:Normal
Assigned To:Tomáš Strachota
Category:Foreman commands
Target version:Foreman - Sprint 21
Difficulty: Bugzilla link:
Found in release: Pull request:
Story points-
Velocity based estimate-

Description

Hello.

I'm not able to add new template using hammer to foreman. It was working fine previously in foreman 1.3.x version.

Please see the details:

$ hammer --verbose template create --file /tmp/My_CentOS_Kickstart_Default --type provision --name My_CentOS_Kickstart_Default
[ INFO 2014-02-01 14:54:25 Init] Initialization of Hammer CLI (0.0.18) has started...
[ INFO 2014-02-01 14:54:25 Init] Configuration from the file /etc/foreman/cli_config.yml has been loaded
[ INFO 2014-02-01 14:54:25 Modules] Extension module hammer_cli_foreman (0.0.18) loaded
[ INFO 2014-02-01 14:54:25 HammerCLI::MainCommand] Called with options: {"option_verbose"=>true}
[ INFO 2014-02-01 14:54:25 HammerCLIForeman::Template] Called with options: {}
[ INFO 2014-02-01 14:54:25 HammerCLIForeman::Template::CreateCommand] Called with options: {"option_name"=>"My_CentOS_Kickstart_Default", "option_type"=>"provision", "template"=>"install\ncmdline\n<%= @mediapath >\nlang en_US.UTF-8\nselinux --permissive\nkeyboard us\nskipx\nnetwork --bootproto <%= @static ? \"static\" : \"dhcp\" %> --hostname <%= @host %>\nrootpw --iscrypted <%= root_pass %>\nfirewall --disabled\nauthconfig --useshadow --passalgo=sha256 --kickstart\ntimezone --utc Europe/Prague\nservices --disabled autofs,gpm,sendmail,cups,iptables,ip6tables,auditd,arptables_jf,xfs,pcmcia,isdn,rawdevices,hpoj,bluetooth,openibd,avahi-daemon,avahi-dnsconfd,hidd,hplip,pcscd,restorecond,mcstrans,rhnsd,yum-updatesd\n\nrepo --name=\"Extra Packages for Enterprise Linux\" --mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-<%= @host.operatingsystem.major %>&arch=<%= @host.architecture %>\nrepo --name=\"Puppet Labs Products El <%= @host.operatingsystem.major %> - <%= @host.architecture %>\" --baseurl=http://yum.puppetlabs.com/el/<%= @host.operatingsystem.major %>/products/<%= @host.architecture %>\nrepo --name=\"Puppet Labs Dependencies El <%= @host.operatingsystem.major %> - <%= @host.architecture %>\" --baseurl=http://yum.puppetlabs.com/el/<%= @host.operatingsystem.major %>/dependencies/<%= @host.architecture %>\n\nbootloader --location=mbr --append=\"nofb verbose\" <%= grub_pass %>\n\n< if @dynamic ->\n%include /tmp/diskpart.cfg\n< else ->\n<%= @host.diskLayout %>\n< end ->\n\ntext\nreboot\n\n%packages --ignoremissing --nobase\naugeas\ndhclient\nepel-release\nntp\npuppet\nwget\nyum\n%end\n\n< if @dynamic ->\n%pre\n<%= @host.diskLayout %>\n%end\n< end -%>\n\n%post --nochroot\nexec < /dev/console > /dev/console 2>&1;\n#exec < /dev/tty3 > /dev/tty3\n#changing to VT 3 so that we can see whats going on....\n#/usr/bin/chvt 3\n(\ncp -va /etc/resolv.conf /mnt/sysimage/etc/resolv.conf\n#/usr/bin/chvt 1\n) 2>&1 | tee /mnt/sysimage/root/install.postnochroot.log\n%end\n\n%post\nlogger \"Starting anaconda <%= @host %> postinstall\"\nexec < /dev/console > /dev/console 2>&1;\n#exec < /dev/tty3 > /dev/tty3\n#changing to VT 3 so that we can see whats going on....\n#/usr/bin/chvt 3\n(\n#update local time\necho \"updating system time\"\n/usr/sbin/ntpdate -sub <%= @host.params[\"ntp-server\"] || \"0.fedora.pool.ntp.org\" %>\n/usr/sbin/hwclock --systohc\n\necho \"Configuring puppet\"\ncat > /etc/puppet/puppet.conf << EOF\n<%= snippets \"puppet.conf\" %>\nEOF\n\n# Setup puppet to run on system reboot\n/sbin/chkconfig --level 345 puppet on\n\n/usr/bin/puppet agent --config /etc/puppet/puppet.conf -o --tags no_such_tag --server <%= @host.puppetmaster %> --no-daemonize\n\nsync\n\n# Inform the build system that we are done.\necho \"Informing Foreman that we are built\"\nwget -q -O /dev/null --no-check-certificate <%= foreman_url %>\n# Sleeping an hour for debug\n) 2>&1 | tee /root/install.post.log\nexit 0\n\n%end\n"}
[ERROR 2014-02-01 14:54:26 Exception] Template can't be blank
Template kind can't be blank
Could not create the config template:
Template can't be blank
Template kind can't be blank

$ hammer --version
hammer (0.0.18) * hammer_cli_foreman (0.0.18)

$ rpm -qa | egrep 'foreman|hammer'
foreman-release-1.4.0-1.el6.noarch
rubygem-hammer_cli_foreman-0.0.18-1.el6.noarch
rubygem-foreman_api-0.1.11-1.el6.noarch
rubygem-hammer_cli-0.0.18-1.el6.noarch
foreman-installer-1.4.0-1.el6.noarch
foreman-proxy-1.4.0-1.el6.noarch
foreman-1.4.0-1.el6.noarch
foreman-mysql2-1.4.0-1.el6.noarch
foreman-selinux-1.4.0-1.el6.noarch

Thanks for checking it.

PetrR


Related issues

Duplicated by Hammer CLI - Bug #4560: hammer template create expects a number for --type but th... Duplicate 03/05/2014

History

#1 Updated by Dominic Cleal almost 4 years ago

  • Project changed from Foreman to Hammer CLI
  • Category set to Foreman commands
  • Release deleted (1.4.0)

#3 Updated by Tomáš Strachota over 3 years ago

  • Status changed from New to Ready For Testing
  • Assigned To set to Tomáš Strachota

#4 Updated by Dominic Cleal over 3 years ago

  • Target version set to Sprint 21

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

  • Status changed from Ready For Testing to Closed

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

  • Duplicated by Bug #4560: hammer template create expects a number for --type but there's no way to retrieve template_kind IDs added

Also available in: Atom PDF