Skip to content
This repository was archived by the owner on Oct 31, 2023. It is now read-only.

YAML provided hash with "/" in the lines #154

@stephencooke

Description

@stephencooke

I have been using yaml files to store variables and I have came accross a feature I dont like.

If a dataelement has a / in it, it makes the server build fail with this.

No matching flavor was found! Please check your flavor setting to
No matching image was found! Please check your image setting to

Original YAML file.

  flavor: '/8 GB General Purpose v1/'
  image: '/CentOS 6 \(PVHVM\)/'  

I corrected this by adjusting the examples provided that show / and replaced it with "(doublequote)" Then removed all the escaping, making the YAML string much tidier.

YAML file has the following items

  flavor: '8 GB General Purpose v1'
  image: 'CentOS 6 (PVHVM)'  

the following works fine

servers.each do |servers|
                config.vm.define servers["name"] do |srv|
                        srv.vm.provider :rackspace do |rs, override|
                                override.nfs.functional = false
                                rs.server_name = servers["hostname"]
                                rs.username = servers["username"]
                                rs.api_key = servers["api_key"]
                                rs.flavor = "#{servers["flavor"]}"
                                rs.image = "#{servers["image"]}"
                                rs.rackspace_region = servers["rackspace_region"]
                                rs.network  servers["network"]
                                rs.key_name = servers["key_name"]
                                rs.init_script = 'sed -i\'.bk\' -e \'s/^\(Defaults\s\+requiretty\)/# \1/\' /etc/sudoers'
                        end
...
...

However this removes the / char as this wasnt working with the provisioning this is using new vagrant 1.9.1. Am sure that this worked for me on 1.8.4 as most of our platforms Use a server.yaml hash.

My original version of this just hard coded the line. YAML passing the / and vagrant reading it directly on the rs.X line seems to be the trouble. Thought it is worth a mention as most of the examples show using /.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions