Project

General

Profile

Actions

Bug #2071

closed

provisioning ec2 instance fails with ruby 1.9.x

Added by Olivier Le Cam almost 12 years ago. Updated almost 12 years ago.

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

Description

Under Debian/Wheezy, ruby 1.9.3p194, foreman installed from master.

generating template to upload to ec2-test-8.aws.netify.fr
Preparing Post installation script for ec2-test-8.aws.netify.fr task failed with the following error: unexpected prefix_suffix: 10
Rolling back due to a problem: [Preparing Post installation script for ec2-test-8.aws.netify.fr  2000    failed  [#<Host id: 10, name: "ec2-test-8.aws.netify.fr", ip: "23.22.50.89", environment: nil, last_compile: nil, last_freshcheck: nil, last_report: nil, updated_at: "2012-12-25 11:17:50", source_file_id: nil, created_at: "2012-12-25 11:17:50", mac: "", sp_mac: "", sp_ip: "", sp_name: "", root_pass: nil, serial: nil, puppet_status: 0, domain_id: 1, architecture_id: 1, operatingsystem_id: 1, environment_id: 1, subnet_id: nil, sp_subnet_id: nil, ptable_id: 11, medium_id: nil, build: true, comment: "", disk: "", installed_at: nil, model_id: nil, hostgroup_id: 1, owner_id: 1, owner_type: "User", enabled: true, puppet_ca_proxy_id: 1, managed: true, use_image: nil, image_file: nil, uuid: "i-cc191fb2", compute_resource_id: 1, puppet_proxy_id: 1, certname: nil, image_id: 1, organization_id: nil, location_id: nil>, :setSSHProvisionScript]]

It seems that Tempfile doesn't support integer as basename anymore. The following trivial patch fixed the issue with me:

--- a/lib/foreman/renderer.rb
+++ b/lib/foreman/renderer.rb
@@ -53,7 +53,7 @@ module Foreman
     end
     alias_method :pxe_render, :unattended_render

-    def unattended_render_to_temp_file content, prefix = id, options = {}
+    def unattended_render_to_temp_file content, prefix = id.to_s(), options = {}
       file = "" 
       Tempfile.open(prefix, Rails.root.join('tmp') ) do |f|
         f.print(unattended_render(content))
<pre>
</pre>
Actions

Also available in: Atom PDF