Avatar of cloudtechnician
cloudtechnician

asked on 

Unable to Fetch JSON Values In Chef Recipe

Just getting started with using chef recently.  I have created custom JSON in AWS Opswork and trying to access it as an attribute in Chef recipe, but its failing to grab the JSON values. JSON file looks like.
{
 "normal": { 
 "filbeat": {
 "log_path" : "/var/log/*.log",
 "hosts" : "Some Random Host ID", 
 "port"  : 5000
 }
 }
}

Open in new window


and I am trying to catch it in recipe as,

log = node['filebeat']['log_path']
hosts = node['filebeat']['hosts']
port = node['filebeat']['port']

Open in new window


But it failed, I have also tried without 'normal'. I got the some []null class error.
IT AdministrationRubyJSONAWSCloud Computing

Avatar of undefined
Last Comment
Uros Gaber
ASKER CERTIFIED SOLUTION
Avatar of Uros Gaber
Uros Gaber

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
IT Administration
IT Administration

IT Administration is the processes and best practices for programming and development, and incorporates methodologies for managing activities and projects. Common methodologies include waterfall, prototyping, iterative and incremental development, spiral development, rapid application development, extreme programming and various types of agile methodology. The life-cycle "model" is a more general term for a category of methodologies, and a software development "process" a more specific term to refer to a specific process chosen by a specific organization.

7K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo