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

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

Open
stephencooke opened this issue Jan 25, 2017 · 0 comments
Open

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

stephencooke opened this issue Jan 25, 2017 · 0 comments

Comments

@stephencooke
Copy link

stephencooke commented Jan 25, 2017

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 /.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant