Project

General

Profile

Bug #1134

Multiple host exporting formatting for rundeck not correct

Added by Marcello de Sousa almost 8 years ago. Updated almost 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
API
Target version:
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

When rundeck reads it, we get:

java.lang.IllegalArgumentException: Required property 'nodename' was not specified

Currently Foreman is exporting multiple hosts to rundeck using this format (but it looks like the single "-" between each host makes the YAML be interpreted as a sequence, and should not be there) :

--- 
  - 
    puppet.perimeterusa.com: 
      osVersion: "6.1" 
      osName: RedHat
      username: Admin User
      osArch: x86_64
      nodename: puppet.perimeterusa.com
  - 
    test.perimeterusa.com: 
      osVersion: "5.7" 
      osName: RedHat
      username: Admin User
      osArch: x86_64
      nodename: test.perimeterusa

This seems to work (with nothing in between):

--- 
    puppet.perimeterusa.com: 
      osVersion: "6.1" 
      osName: RedHat
      username: Admin User
      osArch: x86_64
      nodename: puppet.perimeterusa.com

    test.perimeterusa.com: 
      osVersion: "5.7" 
      osName: RedHat
      username: Admin User
      osArch: x86_64
      nodename: test.perimeterusa

This also seems to work (with "---" in between):

--- 
    puppet.perimeterusa.com: 
      osVersion: "6.1" 
      osName: RedHat
      username: Admin User
      osArch: x86_64
      nodename: puppet.perimeterusa.com
 ---
    test.perimeterusa.com: 
      osVersion: "5.7" 
      osName: RedHat
      username: Admin User
      osArch: x86_64
      nodename: test.perimeterusa

Other examples:
Current invalid export:
http://fpaste.org/OVr4/

Valid Examples:
http://fpaste.org/HpZA/
http://fpaste.org/OVr4/

According to ashp's chat history in #rundeck:
"...you have a sequence where you should have a map" (yaml related)

An that can be confirmed when I paste it in the website:
http://yaml-online-parser.appspot.com/
(select "canonical yaml" as output)

Associated revisions

Revision 48e0b3a4 (diff)
Added by Ohad Levy almost 8 years ago

fixes #1134 - Multiple host exporting formatting for rundeck not correct

History

#1 Updated by Marcello de Sousa almost 8 years ago

Links with the examples

YAML sequence (not working):
http://goo.gl/wgvt0

YAML map (working):
http://goo.gl/7RGZz

#2 Updated by Marcello de Sousa almost 8 years ago

Fix by Ohad:

diff --git a/app/controllers/hosts_controller.rb b/app/controllers/hosts_controller.rb
index c869d71..5969298 100644
--- a/app/controllers/hosts_controller.rb
+++ b/app/controllers/hosts_controller.rb
@@ -43,7 +43,9 @@ class HostsController < ApplicationController
       format.json { render :json => search.all(:select => "hosts.name", :include => included_associations).map(&:name) 
       format.yaml do
         render :text => if params["rundeck"]
-          search.all(:include => included_associations).map(&:rundeck)
+          result = {}
+          search.all(:include => included_associations).each{|h| result.update(h.rundeck)}
+          result
         else
           search.all(:select => "hosts.name").map(&:name)
}

#3 Updated by Ohad Levy almost 8 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF