FAQ Database Discussion Community


How to traverse a nested dict structure with Ansible?

yaml,ansible,ansible-playbook
I have the following dict structure variable in an ansible playbook: apache_vhosts: - name: foo server_name: foo.com server_aliases: - a.foo.com - b.foo.com - c.foo.com - name: bar server_name: bar.com server_aliases: - d.bar.com - e.bar.com - f.bar.com I need to create a symlink for each of the server_name and server_aliases domains,...

Symfony2 Undefined variable: handleRequest

php,html,symfony2,yaml
I am trying to develop a basic form in Symfony2 and to get the handleRequests to work. However I am having the error undefined variable handleRequest and cannot seem to solve the problem! This is my Controller <?php namespace James\workBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use James\workBundle\Entity\Task; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; class DefaultController...

How to escape the '#' comment character within Ansible lineinfile module?

escaping,yaml,ansible
How can I escape characters in Ansible's lineinfile module? Here's the line I want to insert on the server: EMAIL='[email protected]' # Server notification email address enter only 1 address But when I try the following, Ansible refuses to parse it due to YAML errors: line="EMAIL='{{ email_address }}' # Server notification...

Best practice for sharing translation of Active Record attributes

ruby-on-rails,activerecord,internationalization,yaml,rails-activerecord
I have the following yaml in one of my translation files: se: activerecord: attributes: user: name: "Namn" town: "Stad" admin: name: "Namn" level: "Nivå" pet: name: "Namn" company: name: "Namn" food: name: "Namn" Is there a way for me to DRY this up and share the translation of name across...

multiples dbms in precondition of liquibase using yaml

yaml,liquibase,preconditions
In precondition documentation of liquibase we can see the example below: <preConditions> <dbms type="oracle" /> <dbms type="mysql" /> </preConditions> When try to recreate the same rule using yaml, it not works. preConditions: dbms: type: oracle dbms: type: mysql I also have tried something like: preConditions: - dbms: dbms: type: oracle...

How do I convert a python list to simple YAML?

python,yaml
My lists are very small and I can do these by hand, but I'm looking for the right way to do this programmatically. I have this as a test: import yaml a = ['item 1','item 2','item 3','item 4'] yaml.dump(a) which give me this: '[item 1, item 2, item 3, item...

Parsing json/yaml array with yaml-cpp

c++,arrays,json,yaml,yaml-cpp
I am using yaml-cpp for my configuration files parsing because I have to be able to parse yaml and json files and this is the only cpp library supporting yaml 1.2 I have found. While parsing, I do not ask for key because I do not know what component is...

Why I get undefined method `each'?

ruby,ruby-on-rails-4,yaml
In application.rb I tried to read a YAML file: config.before_configuration do env_file = File.join(Rails.root, 'config', 'local_env.yml') YAML.load(File.open(env_file)).each do |key, value| ENV[key.to_s] = value end if File.exists?(env_file) end but, I get this error: /var/www/config/application.rb:26:in `block in <class:Application>': undefined method `each' for #<String:0x00000007afb7f0> (NoMethodError) from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.1.6/lib/active_support/lazy_load_hooks.rb:36:in `call' from...

Ansible, YAML, and Syntax

python,networking,yaml,ansible,ansible-playbook
I am trying to create an Ansible configuration that will run a playbook and utilize a single variable file to create a single configuration with multiple items. I am trying the following syntax and it is failing. How can I fix this? vars/main.yml --- or1host1: - interface: 1/1 description: or1-servertest...

Wrap yaml data in single quotes

regex,awk,sed,yaml
I would like to wrap all of my YAML data (in a large file) with single quotes. I tried sed, but it did not work: sed "s/\(.*: \)\(.*\)/\1'\2'/" <data.yml >datanew.yml This took lines like this: location_id: 25 street: text: This is text: it contains colons And produced lines like: '...

Trying to read multi valued items using YAML

perl,oracle,yaml
I am building a script that will install database software. Depending on the release I will need to be able to connect to one or more databases and I will need passwords for different users. Hence when we build the patch we can specify in one file what the customer...

What does the dot mean in Symfony service names?

symfony2,service,configuration,yaml
Look at this documentation page, for instance. Several service names are dotted, and I wanted to know if it means we are searching an object's method or if it is nothing. Note I am talking about service names in YAML format....

How to add values to a YAML hash using Ruby

ruby,hash,yaml,webhooks,hiera
I have a bunch of Hashes in a YAML file (its for Puppet/Hiera based config of some servers) that looks like so: --- apache_vhosts: 'webuser.co.uk': ip: '*' port: '80' serveraliases: ['www.webuser.co.uk',] add_listen: false docroot: '/home/webuser/public_html' docroot_owner: 'webuser' docroot_group: 'apache' serveradmin: '[email protected]' scriptalias: '/home/webuser/public_html/cgi-bin/' access_log_format: '\"%{X-Forwarded-For}i\" %l %u %t \"%r\" %>s...

Input Reader dictionary on mapreduce.yaml

google-app-engine,mapreduce,yaml
Ive been trying to launch a specific mapreduce straight from the /mapreduce dashboard, but for that I need input reader parameters passed in as a dictionary or I get BadReaderParamsError: Input reader parameters should be a dictionary The problem is yaml validation won't let me add any kind of nested...

Custom yaml syntax

ruby,yaml,jekyll,liquid
Im using Jekyll and liquid syntax and would like to add a custom background colour and thumbnail image for each of my projects on my homepage. How can I achieve this using YAML frontmatter? liquid syntax outputting projects {% for post in site.categories['project'] %} <div class="project"> <h3 class="project__title">{{ post.title }}</h3>...

C++ YAML: How to edit/write to a node in a .yaml file

c++,yaml,yaml-cpp
I am trying to write a function that will write/edit a node in my .yaml file using yaml-cpp. I kind of got it working as my code will edit the local copy. When I print out _baseNode it shows that the node has the value 5.4 in it. However, after...

aws beanstalk config options for document root

amazon-web-services,yaml,elastic-beanstalk,amazon-elastic-beanstalk
I'm trying to predefine instance settings via config file but it just won't take it... if I create the environment it never reflects the settings. I think I might just miss something obvious but can't find a solution. I probably terminated and created the env now 30 times with different...

parsing yaml in ocaml

ocaml,yaml
I am looking for the easiest way to using yaml with ocaml, and I am having a hard time finding a good library for doing this - since I am new to the ocaml community I would am having a hard time separating the small, not all that done, projects...

Swagger Error Expected type string but found type integer

java,yaml,swagger
I started working recently on swagger to generate documentation for our RESTful apis. I use the yamlbeans-1.09.jar to convert my Java DTOs to a yaml file. Everything works fine and the yaml is even validated properly on the http://www.yamllint.com/ but still while testing it with the Swagger interface, it gives...

Using Docker-Compose, how to execute multiple commands

docker,yaml,docker-compose
I want to do something like this where I can run multiple commands in order. db: image: postgres web: build: . command: python manage.py migrate command: python manage.py runserver 0.0.0.0:8000 volumes: - .:/code ports: - "8000:8000" links: - db ...

Control order of hashref with YAML::XS

perl,yaml,libyaml
I'm dumping a data structure to YAML with the YAML::XS library: foo => { bar => [ {...}, {...}, ], baz => [ {...}, {...}, ], ... } It seems like YAML::XS's default behavior is to sort the keys before dumping them, but this is not what I want. Humans...

Spring boot date handling in application.yaml and properties

date,configuration,yaml,spring-boot
I am creating a simple spring boot application, that loads a string (ISO-date) from the application.yaml file and tries to put it into a @Value annotated field. If I use a .yaml file the string is obviously converted into a date/calendar and afterwards "toStringed" into a different format. If I...

add link to YAML in multimarkdown metadata

yaml,markdown,multimarkdown
I'm writing my CV in MMD. I'd like to add a link to my website, twitter account etc in the mmd metadata and then reference that in the pdf, html, latex that is generated from the mmd. Here's an example mmd file. --- Name: Mark Ruddy Website: [myWebsite](http://myWebsite) Street: my...

C# parse and change strings in yaml

c#,python,parsing,yaml,yamldotnet
I am looking for a way to parse yaml file and change each string then save file without changing structure of original file. In my opinion I should not use Regex for this but some kind of yaml parser. Sample yaml input bellow: receipt: Oz-Ware Purchase Invoice date: 2007-08-06 customer:...

REST API design for cloning a resource

api,rest,post,yaml,webdav
I am writing a YAML document using swagger to design a RESTful API method for cloning a resource. I have a few options and don't know which would be best. Please can someone advise? Options: Relinquishing the responsibility of cloning the resource object to the consumer (where the consumer assigns...

Save SQL to YAML as is

python,sql,yaml,pyyaml
I want to save SQL to YAML-file in my own format as below: (1) sql: SELECT DISTINCT p.id_product, p.price AS price, sp.reduction AS discount FROM .... I use following settings of YAML yaml.safe_dump(app_config, stream, indent=4, default_flow_style=False, encoding='utf-8', allow_unicode=True) however I got 'classic' ugly output of YAML (2) sql: SELECT DISTINCT...

Ruby, writing to a YAML file, with arrays

ruby,file,yaml
I'm trying to save a few variables in a YAML config file. Cool!! However, when I try and save them, I get an error in RUBY: undefined method `[]=' for false:FalseClass (NoMethodError) My function should (In my head at least) be: Does the config file exist, if not, just create...

GDBM vs a simple JSON, INI or YAML configuration file

json,database,yaml,ini,gdbm
I am studying about file based key-value databases such as GDBM and I can not see any real advantage versus using a configuration file. Both technologies let you store in a file keys and values. Is it the advantage of GDBM the performance, does GDBM parse the file faster?...

Symfony YAML include file

symfony2,yaml
How can I split my security.yml into multiple files? I know about the imports statement, but I need to import the role_hierarchy. For example security: encoders: FOS\UserBundle\Model\UserInterface: sha512 role_hierarchy: ROLE_USER: //IMPORT FROM USER.YML ROLE_SELLER: //IMPORT FROM ANOTHER SELLER.YML ROLE_ADMIN: //IMPORT FROM ADMIN.YML ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH] I need this because I...

How to pass variable that's a dictionary into Ansible Role?

yaml,ansible,ansible-playbook
I want to pass some values into an Ansible role, but I can't find any examples in the docs that show how to pass in a variable that's a dictionary. Here is what I'd like to pass in, but my YAML syntax is off: roles: - { role: postgresql, postgresql_users:...

How to convert YAML to JSON?

c#,.net,json,yaml,yamldotnet
I'm looking to convert between a YAML file, and JSON. This was really difficult to find any information on.

Parsing a YAML document with a map at the root using snakeYaml

java,yaml,snakeyaml
I want to read a YAML document to a map of custom objects (instead of maps, which snakeYaml does by default). So this: 19: typeID: 2 limit: 300 20: typeID: 8 limit: 100 Would be loaded to a map which looks like this: Map<Integer, Item> where Item is: class Item...

Ruby executable in YAML

ruby-on-rails,ruby,yaml
I have a sample yaml file(abc.yaml) like this: entity1: condition: "created_at >= #{Date.today - 3.months}" I want to read this condition from YAML in Ruby as : "created_at >= 2015-03-02" But when I do YAML.load_file('abc.yaml')["entity1"]["condition"] I get: "created_at >= \#{Date.today - 3.months}" Please let me know how to work around...

unable to convert yaml string to map with key “NO” in java

java,rest,yaml
While I am trying to convert yaml string to Map I am getting key change. YAML File:- --- HK: isp: Airtel: AirtelChennal www.enemalta.com: default: defaultEma user1: chennal1 studiodefault: hkDefaultchennal country: DK: denmarkChennal NO: chennal2 Java code:- Yaml yaml= new Yaml(); Map<String,Object> map= (Map<String, Object>) yaml.load(yamlString); output :- {HK={isp={Airtel=AirtelChennal}, www.enemalta.com={default=defaultEma, user1=chennal1},...

Json to yaml conversion does not work?

json,jackson,yaml
I am trying to convert json object to yaml file. But i am getting incorrect yaml file.some one help me to resolve this. Java code:- public class Trials { private JsonNodeFactory nodeFactory; public ArrayNode getJSONObject() { nodeFactory = JsonNodeFactory.instance; ArrayNode obj1 = nodeFactory.arrayNode(); ObjectNode obj11 = nodeFactory.objectNode(); ObjectNode obj12 =...

Cannot get assign where working in Jekyll template

yaml,jekyll
I have built my website in Jekyll. The data file is working fine when parsed elsewhere, but when I try to access a particular record using a where clause I get no result. See the project at https://github.com/ohiweb/ohiweb.github.io The troublesome page is under portfolio\betimca\index.html portfolio.yml projects: - name: "betimca" title:...

Pyyaml - Using different styles for keys and integers and strings

python,python-2.7,yaml,pyyaml
--- "main": "directory": "options": "directive": 'options' "item": "options": 'Stuff OtherStuff MoreStuff' "directoryindex": "item": "directoryindex": 'stuff.htm otherstuff.htm morestuff.html' "fileetag": "item": "fileetag": 'Stuff' "keepalive": "item": "keepalive": 'Stuff' "keepalivetimeout": "item": "keepalivetimeout": 2 above is a YAML file which I need to parse, edit then dump. I have chosen to do so with pyyaml...

Is there any javascript library to check yaml syntax? [closed]

javascript,yaml,syntax-checking,error-checking
I am implementing online YAML code editor using Ace Opensource code editor. I want a javascript library to check yaml syntaxes....

Custom bool parsing in PYYAML

python,yaml,pyyaml
I need to parse booleans in PYYAML in a custom way and convert them into strings. For that purpose I tried to write a 'constructor' and registered it with yaml, but it didn't do anything. Booleans got parsed as normal. Is it a problem with the tag or do I...

Loading the same properties(yml) files in testing enviornment?

java,spring,configuration,yaml,spring-boot
I am trying to figure out whether I can load the same .yml property files in testing environment as I load in real. For example I have a test: \src\test\java\security\TokenTest.java Annotated with: @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = Application.class) @WebAppConfiguration @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @ActiveProfiles("dev") Then I have: \src\main\resources\application.yml When I run the application,...

Create nested object from YAML to access attributes via method calls in Ruby

parsing,yaml,openstruct
I am completely new to ruby. I have to parse a YAML file to construct an object YAML File projects: - name: Project1 developers: - name: Dev1 certifications: - name: cert1 - name: Dev2 certifications: - name: cert2 - name: Project2 developers: - name: Dev1 certifications: - name: cert3 -...

unable to convert yaml string to json string using java

java,json,rest,yaml
I want to convert a yaml string to a json string by using "jyaml", kindly some one help me to resolve this YAML string :- Korea: www.gozoculture.com: default: jhfjfjfj www.5plus5.gov.mt: default: jhfjfjfj www.ces.gov.mt: default: cesDefault user5: chennal5 isp: Tata DoCoMo: chennalisp1 Hathway: chennalIsp Hong Kong: chennalisp2 Aircel: chennalIspaircel Airtel: chennalIspAirtel...

Split the title onto multiple lines?

r,yaml,markdown,rstudio
In an R markdown document (html and presentations), is it possible to manually split the title onto multiple lines? I tried playing with pipes which produces orrendous output. --- title: 'A title I want to split on two lines' author: date: output: ioslides_presentation --- ...

How can I specify the file location to write and read from in Ruby?

ruby,function,yaml,file-writing
So, I have a function that creates an object specifying user data. Then, using the Ruby YAML gem and some code, I put the object to a YAML file and save it. This saves the YAML file to the location where the Ruby script was run from. How can I...

Building an array of dictionary items in YAML?

yaml,pyyaml
Basically trying to something in yaml that could be done using this json: { models: [ { model: "a" type: "x" #bunch of properties... }, { model: "b" type: "y" #bunch of properties... } ] } So far this is what I have, it does not work because I am...

How to perform Pub Get programatically from a Dart program

dart,install,yaml,dart-pub
I'm building a Dart framework called Modular for backend development and this framework has a installer for convenience. At the end of the installation, I'd like to install all dependancies in the generated pubspec.yaml file. How would I do this? Thank you

Specifying styles for portions of a PyYAML dump (II): sequences

python,formatting,yaml
This is a follow up question to Specifying styles for portions of a PyYAML dump: Consider following code contaning as input manually formatted YAML data. I am modifying the YAML data, but would like to keep edges on single lines in the written YAML file. import yaml st2 = yaml.load("""...

How to edit .vimrc file to replace tab with spaces?

vim,tabs,yaml,spaces
I am writing a Python script which writes some formatted data into a YAML file. I am using tabs for formatting the text, but I want the tabs to be converted into spaces when written into the YAML file. This is because my YAML file does not take tabs as...

Ruby: Chatterbot can't load bot data

ruby,yaml
I'm picking up ruby language and get stuck at playing with the chatterbot i have developed. Similar issue has been asked here Click here , I did what they suggested to change the rescue in order to see the full message.But it doesn't seem right, I was running basic_client.rb at...

hiera-eyaml undefined method `empty?'

yaml,puppet,hiera
I would like to store my node config in a .eyaml file. "hieradata/node/client.puppetmaster.local.eyaml" --- ntp::restrict: - ntp::autoupdate: false ntp::enable: true ntp::servers: - 0.pool.ntp.org - 1.pool.ntp.org - 2.pool.ntp.org - 3.pool.ntp.org but when I try to read a parameter with hiera ntp::servers ::fqdn=puppet.puppetmaster.local I get this error Messages /var/lib/gems/1.9.1/gems/hiera-eyaml-2.0.7/lib/hiera/backend/eyaml_backend.rb:39:in `block in lookup':...

How to import yml file into MySQL Database?

mysql,sql,import,phpmyadmin,yaml
I just looked for every option in my PHPMyAdmin. But just can't find any thing that kinda works for. I got this databasefile from a company for freelance work. I said to them it will be fine i can do it. But 2 days later is still haven't found anything...

Symfony 2 setting up translation files

symfony2,internationalization,yaml
I am failing to setup translation for my Symfony 2 project. I have manually created a folder inside app\Resources\translations\message.en.yml and it's content: base: title: homePage: TeamERP IMS for BA Then on the base twig template inside my bundle I am trying to call it: <title> {% block title %} {{...

“Invalid plugin.yml” message on enable of Bukkit plugin

java,yaml,bukkit
I'm working on my first Bukkit plugin. Here's my main class in the eruverio.EruvPlg package: package eruverio.EruvPlg; import org.bukkit.plugin.java.JavaPlugin; public final class main extends JavaPlugin { } And here's the plugin.yml: name: Test main: eruverio.EruvPlg.main version: 1.0 Project structure: | Project ----| src/main/java | ----| eruverio.EruvPlg (Package) | ----| main.java...

Yaml syntax to create this array

syntax,yaml
Given the following simple yaml data, foo: 1 bar: - one - two if I want to create an array of the exact same data structure, what's the correct way? I've tried first: foo: 1 bar: - one - two - three second: foo: 2 bar: - one1 - two2...

Can I set command line arguments using the YAML metadata

yaml,markdown,pandoc
Pandoc supports a YAML metadata block in markdown documents. This can set the title and author, etc. It can also manipulate the appearance of the PDF output by changing the font size, margin width and the frame sizes given to figures that are included. Lots of details are given here....

How to include user info in yaml menu in symfony2?

symfony2,twig,yaml
I am currently developping using symfony2 and using FOSUserBundle for user management. I built a menus.yml config file to separate html from menu structure. Basicaly I import menus.yml in my config.yml file and it's added to twig's global vars. Here's a look at my menus.yml (Abridged version) twig: globals: menus:...

Loop through a nested python dictionary/list loaded from yaml

python,dictionary,nested,yaml
Ok, this is probably stupid. Basically i'm trying to loop through my nested yaml-file and do stuff with for example every key-a value in my list. I have read alot and i'm able to loop through a nested dictionary without the list but I don't wan't to use unique key's...

Read unknown data from yml configuration file

java,yaml,config,bukkit
I'm writing a bukkit plugin which should read data from a yml configuration file made by users like shown in the example below. I've searched for that before with no result, in fact I don't really know what I should search for. Example config: maps: 01: name: world displayname: Plains...

How can I add a comment to a YAML file in Python

python,yaml
I am writing a YAML file using https://pypi.python.org/pypi/ruamel.yaml The code is like this: import ruamel.yaml from ruamel.yaml.comments import CommentedSeq d = {} for m in ['B1', 'B2', 'B3']: d2 = {} for f in ['A1', 'A2', 'A3']: d2[f] = CommentedSeq(['test', 'test2']) if f != 'A2': d2[f].fa.set_flow_style() d[m] = d2 with...

Yaml numeric keys: can't start with zero?

twig,yaml
Let's say I have this .yml file used for Symfony2 i18n month: 01: Jan 02: Feb 03: Mar 04: Apr 05: May 06: Jun 07: Jul 08: Aug 09: Sep 10: Oct 11: Nov 12: Dec In twig, for tanslation, I will use something like {% set month = my_date|date("m")...

How to unmarshal YAML in Go

go,yaml
I have a hard time to unmarshal this piece of YAML in Go. The error I'm getting is cannot unmarshal !!seq into map[string][]map[string][]string. I've tried all kind of maps with no success (map[string]string ; []map[string]string and so on) import ( "gopkg.in/yaml.v1" "io/ioutil" ) type AppYAML struct { Runtime string `yaml:"runtime,omitempty"`...

Log4j2 : How to configure multiple Appender with same type in Yaml configuration

yaml,log4j2,rollingfileappender
I'm trying to have 2 RollingRandomAccessFile in the same YAML configuration. I'm able to do it in XML but not in YAML. As a result, I want two files "application.log" and "payload.log". Here's my working XML configuration : <?xml version="1.0" encoding="UTF-8"?> <Configuration status="debug"> <Appenders> <Console name="CONSOLE" target="SYSTEM_OUT"> <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t]...

Deserialize a YAML “Table” of data

c#,yaml,yamldotnet
I am using yamldotnet and c# to deserialize a file created by a third party software application. The following YAML file examples are both valid from the application: #File1 Groups: - Name: ATeam FirstName, LastName, Age, Height: - [Joe, Soap, 21, 184] - [Mary, Ryan, 20, 169] - [Alex, Dole,...

Difference between I18n.t and t in Rails

ruby-on-rails,ruby,internationalization,yaml
I have a strange problem. I have en.yml file that looks like this: en: no_notifiaction: No Notification active_notification: Active notification t('.active_notification') == "Active notification" #false I18n.t('.active_notification') == "Active notification" #true? Why is that?...

Homestead.yaml *Shell provisioner `args` must be a string or an array

vagrant,yaml,homestead
I was editing my homestead.yaml file and I am certain the indentation is correct -- I however get this following error: Bringing machine 'default' up with 'virtualbox' provider... There are errors in the configuration of this machine. Please fix the following errors and try again: shell provisioner: * Shell provisioner...

Yaml python parcing for multi values

python,python-3.x,yaml
Given test.yml: Step1: input: dd if=/dev/urandom of=/dev/null count=8192 bs=8192 output: 8192+0 records in output: 8192+0 records out Plus python script to read it: import yaml stream = open("test.yml", 'r') Steps = yaml.load(stream) print(Steps) However it returns only the last output: {'Step1': {'output': '8192+0 records out', 'input': 'dd if=/dev/urandom of=/dev/null count=8192...

How to concatenate a parameter value with a constant string in Yaml

symfony2,yaml
I'm using Symfony2. I have an url defined as a parameter in parameters.yml. I want to create a service which is a SOAP client. The argument of the SOAP client is an url for a wsdl file. In my case, the url of the wsdl file is "%parameter_url%" + "?wsdl"....

Go Yaml Interpretation Example

go,yaml
This Go Yaml Interpretation Example, https://gist.github.com/suntong001/74c85d15b19ef4b14b0e, can unmarshal a simple YAML like this: foo: 1 bar: - one - two Now I want to interpretation an array of the exact same data structure, what's the correct way to do? Below is my code so far, and it is not working...

How To Set Folder Permissions in Elastic Beanstalk Using YAML File?

c#,amazon-web-services,configuration,yaml,elastic-beanstalk
I have a C# Web API Elastic Beanstalk app which needs a folder outside the deployment directory that the IUSER and IIS_USERS users can write to. I've created a .config file and put this in the top level .ebextensions folder in my project. The contents are below: commands: 0_mkdir: command:...

how to read each element of an yaml map

yaml,ansible
I am trying to access all the elements of a yaml object, any suggestions would be helpful: object: element1: "value1" element2: "value2" element3: "value3" The above object is defined in group_vars/all file so that it can be accessed by other tasks. - name: pass values to script debug: "msg={{ item...

YAML (Ruby) loading “on” as true

ruby,yaml
I am trying to load a list of words from a YAML file. In the file there is an entry - on Ruby is loading this as "true", instead of "on". Similarly "off" is loaded as "false". A quick check on the Psych code shows "yes" and "no" are treated...

Error with YAML deep nesting

yaml,nesting
I wanted to create a config file in YAML that stores a few translations. To encapsulate everything, I began to nest the options. While parsing the file, I see the following error: Failed to read data from customize.yaml\customize.yaml: yaml: line 30: mapping values are not allow ed in this context...

Loading inherited objects with YAML C++

c++,inheritance,yaml,yaml-cpp
I have some inherited classes: struct BasicShape; struct Circle : BasicShape; struct NGon : BasicShape; struct Star : NGon; struct Triangle : NGon; ... and YAML file which contains the lines: shapes: small_circle: [circle, 5] big_circle: [circle, 8] star7: [ngon, 7, 3] ... which, obviously, represent different shapes with different...

YAML list -> Python generator?

python,event-handling,yaml,pyyaml
I was wondering whether there is an easy way to parse a YAML document consisting of a list of items as a python generator using PyYAML. For example, given the file # foobar.yaml --- - foo: ["bar", "baz", "bah"] something_else: blah - bar: yet_another_thing I'd like to be able to...

Pythonic way to get value defined or not defined in yaml

python,yaml,pyyaml
I have a yaml file with test(s) configuration(s) and there is an optional parameter "ignore-dup-txn" in optional section "test-options". test-name: test-type: trh_txn test-src-format: excel test-src-excel-sheet: invalid_txns test-options: ignore-dup-txn: True I read section "test-name" to "test" dict and for now I check it this way: if 'test-options' in test and 'ignore-dup-txn'...

When I parse YAML with Ruby, it changes my anchor name

ruby,anchor,yaml
I have a YAML file like this: - axis: &kadeployversion type: user-defined name: kadeployversion values: - kadeploy3 - kadeploy3-dev I edited this file with Ruby like this: require 'yaml' jjb = YAML.load_file(fileToParse) jjb[0]['type']='test' File.open(fileToParse, 'w+'){ |f| f.write jjb.to_yaml } But when I read my new file, I have this: -...

Label Git repository in AppVeyor build using environment variable

git,environment-variables,yaml,appveyor
I am trying to label a repository after a successful build in AppVeyor. I have read the following resources: Environment variables appveyor.yml reference Pushing to remote Git repository from a build But I don't know how to substitute in an AppVeyor environment variable. Here is the Yaml that I am...

Configuring SSL on Elastic Beanstalk Single Instance

json,node.js,ssl,amazon-web-services,yaml
I'm trying to install an SSL cert for my NodeJS Beanstalk instance. Following these instructions from Amazon, I created the YAML file and plugged in my information. Every time I try to deploy I get this error: The configuration file .ebextensions/singlessl.config in application version 0.0.3 contains invalid YAML or JSON....

Playframework yaml set syntax

playframework,yaml,snakeyaml
Does PlayFramework have support for yaml sets? I have tried the formats specified by the snakeyaml documentation but only the first member of the set gets added to the set, the rest are ignored. Here are some examples of what I have tried. groups: - &adminGroup !!my.package.UserGroup name: admin roles:...

Using YAML with Swig Templates

yaml,swig-template
Is there an equivalent to Assemble's integration of YAML for Swig? Having to write {% block title %}Title Here{% endblock %} isn't as nice as: --- title: Title Here --- Any ideas on how to integrate YAML with Swig?...

Ansible write variables into YAML file

python,yaml,jinja2,ansible
I have a specific ansible variable structure that I want to get from the vault into a yaml file on my hosts. Lets assume a structure like this: secrets: psp1: username: this password: that secret_key: 123 ... I need something like a "generic" template to output whatever "secrets" contains at...

Ruby parse JSON.load and YAML.load generate different key types

ruby,json,yaml
I've been looking at different options for serializing/de-serializing data. One thing I noticed, that when converting a json string to a hash it uses string literals as keys. When I convert a yaml string to a hash, it uses symbols for keys. I assume this is because for json, they...

How to make Ansible YAML parsing accept this command?

yaml,ansible,ansible-playbook
Question: How to make Ansible YAML parsing accept this command ? Details below: This YAML: -shell: "/home/developer/eclipse/eclipse -application org.eclipse.equinox.p2.director -noSplash -repository 'http://moreunit.sourceforge.net/update-site' -installIUs org.moreunit.feature.group" is validated by: http://yaml-online-parser.appspot.com/ http://www.yamllint.com/ http://codebeautify.org/yaml-validator but ansible says: This one looks easy to fix. It seems that there is a value started with a quote,...

How to fill select options from custom database in .yaml files using typo3-neos?

php,yaml,typo3-flow,typo3-neos
i am currently using typo3-neos for my project and i have this problem. i try to make my custom node like this in .yaml file 'TYPO3.Designs:SomeItem': superTypes: - 'TYPO3.Neos:Content' ui: group: 'structure' label: 'Some Item' icon: 'icon-columns' inlineEditable: true inspector: groups: document: label: 'Item options' position: 1 properties: someitem: type:...

Symfony2 “Parameter ”“ for route ”“ must match ”[^/]++“ (”“ given) to generate a corresponding URL.”

php,symfony2,url,routes,yaml
I have this routes file: indexRechercheZones: path: /gestionzonestechniques defaults: { _controller: MySpaceGestionEquipementsTechniquesBundle:GestionZonesTechniques:indexZonesTechnique } requirements: methods: GET modifierZones: path: /gestionzonestechniques/modifier/{nom} defaults: { _controller: MySpaceGestionEquipementsTechniquesBundle:GestionZonesTechniques:modifierZonesTechnique } requirements: methods: GET modifierZones_process: path: /gestionzonestechniques/modifier/process/{nom} defaults: { _controller:...

Codeception: Webdriver could not be found and loaded

selenium,webdriver,yaml,codeception
I am having some issues running Codeception with Selenium on Windows 8 at my new job. I get this error: [Codeception\Exception\Configuration] Webdriver could not be found and loaded. I started the Selenium server manually like I described last time in this post: Web Driver Curl Exception Anyone have any ideas...

Mapping Nested Tree With Doctrine 2 and YAML

doctrine2,tree,doctrine,yaml
We are currently working on implementing a nested tree using the DoctrineExtensions module. We believe we have wired everything up correctly, however when we go to flush using Doctrine, we keep getting an Exception. SyntaxErrorException in AbstractMySQLDriver.php line 90: An exception occurred while executing 'INSERT INTO ProductTree (left, right, rootProductTreeID,...

YAML::Syck generates list instead of hash

perl,yaml
If I run the below script, then the two hashes are the same, but when I look at how the yaml file looks I see this very weird format --- nicPri --- ixgbe1 --- nicPub --- ixgbe2 --- slaves --- 47: 10.10.47.47 48: 10.10.10.48 --- ipPri --- 10.10.10.46 which doesn't...

How can I print [] without string in Python in YAML file

python,yaml,pyyaml
In my yam file I am trying this with open(fname, "w") as f: yaml.safe_dump({'items':['test', 'test2']}, f, default_flow_style=False, width=50, indent=4) It prints in the below format items: - 'test' - 'test2' I want the output formatted like below items: ['test', 'test2'] How can I do that ? EDIT: This is my...

Ruby Array#to_yaml doesn't call to_yaml recursively

ruby,yaml
The following code require 'yaml' class MyObject def initialize(value) @value = value end def to_yaml() @value + @value end end puts [MyObject.new("a"), MyObject.new("b")] Generated the following output on Ruby 2.1.3p242: --- - !ruby/object:MyObject value: a - !ruby/object:MyObject value: b Where I expected it to be --- - aa - bb...

PyYAML variables in multiline

python,yaml,pyyaml
I'm trying to get a multi-line comment to use variables in PyYAML but not sure if this is even possible. So, in YAML, you can assign a variable like: current_host: &hostname myhost But it doesn't seem to expand in the following: test: | Hello, this is my string which is...

Python YAML parameter reference (get value from other parameter)

python,yaml,pyyaml
I'm trying to use a YAML config file in my Python script, one of the problems I've found is that I can't access other attributes, so I need to duplicate a lot of content. For example root_path: /root script_path: root_path + /scripts This doesn't exists of course, but is there...

yaml-cpp parsing map with sequence as key

yaml,yaml-cpp
I am getting started with yaml-cpp, and I am having troubles decoding one part of my file. The file that I want to decode looks like this: leds: - [251, 252,253] - [254, 250,220] - [230, 231,230] this is how I have been trying to implement but so far is...

Symfony : how to set SSL parameters in Doctrine DBAL configuration (YAML)?

symfony2,pdo,doctrine2,yaml,dbal
I'd like to add my SSL cert and key files to Doctrine DBAL configuration but I don't see how to achieve that. In PHP, I just have to write something like : $databaseHandler = new \PDO( 'mysql:host=my_host;dbname=my_db', 'username', 'password', array( \PDO::MYSQL_ATTR_SSL_KEY => '.../client-key.pem', \PDO::MYSQL_ATTR_SSL_CERT => '.../client-cert.pem', \PDO::MYSQL_ATTR_SSL_CA => '.../ca-cert.pem' )...

Symfony2 - Environments - Can't import routing.yml from common folder

symfony2,yaml,symfony-2.7
I'm trying to create a folder structure like described in Different Directories per Environment: - app - config - common - config.yml - routing.yml - dev - config.yml - routing.yml This does work pretty well for all files (config.yml, parameters.yml etc.) but nor for config.yml. I get this error: The...

How to concatenate the value of iterator inside liquid tag (Jekyll)

ruby,for-loop,yaml,jekyll,liquid
I am looping through a Yaml object and need to append the value of 'i' to the address the proper object. <div class="chapter"> {% for i in (1..7) %} <strong class="title">{{ page.chapters.title + i }}</strong> <ul> {% for topic in page.chapters.ch + i %} <li> {{ topic }} </li> {%...