Project

General

Profile

Actions

Bug #10560

open

foreman-rake config does not parse arrays correctly

Added by Steve Boardwell about 9 years ago. Updated about 8 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Rake tasks
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Hi,

I wanted to add some servers to the trusted_puppetmaster_hosts property to get rid of the following warnings

2015-05-20 11:12:28 [W] No smart proxy server found on ["puppetmaster1a.domain.com", "puppetmaster1a"] and is not in trusted_puppetmaster_hosts

I tried to do this over the commandline, which resulted in:

rake aborted!
JSON::ParserError: 399: unexpected token at '........'
/usr/share/foreman/vendor/ruby/1.9.1/gems/json-1.8.2/lib/json/common.rb:155:in `parse'
/usr/share/foreman/vendor/ruby/1.9.1/gems/json-1.8.2/lib/json/common.rb:155:in `parse'
/usr/share/foreman/lib/tasks/config.rake:134:in `typecast_value'
/usr/share/foreman/lib/tasks/config.rake:106:in `block in run_key_values'
/usr/share/foreman/lib/tasks/config.rake:99:in `each'
/usr/share/foreman/lib/tasks/config.rake:99:in `run_key_values'
/usr/share/foreman/lib/tasks/config.rake:76:in `run'
/usr/share/foreman/lib/tasks/config.rake:150:in `block in <top (required)>'
Tasks: TOP => config
(See full trace by running task with --trace)

or
JSON::ParserError: A JSON text must at least contain two octets!
...
...

...depending on which characters were escaped.

I finally got it to 'not throw an exception' using

foreman-rake -- config -k trusted_puppetmaster_hosts -v "[\\\"puppetmaster1a.domain.com\\\",\\\"puppetmaster1a\\\",\\\"puppetmaster1b\\\"]" 

However, this leaves the slash-quotes (\") in the values. From the config:

trusted_puppetmaster_hosts: "[\"p1service2a.gva.secutix.net\", \"p1service2a\"]" 

This, in turn, results in the warnings still being shown.

2015-05-20 11:12:28 [W] No smart proxy server found on ["puppetmaster1a.domain.com", "puppetmaster1a"] and is not in trusted_puppetmaster_hosts

The only solution at the moment is to add the values through the web interface.

Thanks,
Steve

Actions #1

Updated by Dominic Cleal about 9 years ago

  • Category changed from Users, Roles and Permissions to Rake tasks
Actions

Also available in: Atom PDF