Skip to content
This repository has been archived by the owner on Jan 23, 2019. It is now read-only.

Syntax error in definitions files #49

Closed
joeypdx opened this issue Sep 20, 2013 · 7 comments
Closed

Syntax error in definitions files #49

joeypdx opened this issue Sep 20, 2013 · 7 comments

Comments

@joeypdx
Copy link

joeypdx commented Sep 20, 2013

While using 0.12.0 in a recipe under Chef Solo, I encountered the following errors. These errors don't occur using 0.11.3.

Recipe Compile Error in /tmp/chef-solo/site-cookbooks/postgresql/definitions/pg_database.rb

SyntaxError

compile error
/tmp/chef-solo/site-cookbooks/postgresql/definitions/pg_database.rb:1: syntax error, unexpected ':', expecting $end
define :pg_database, action: :create do
^

Cookbook Trace:

/tmp/chef-solo/site-cookbooks/postgresql/definitions/pg_database.rb:1:in from_file' /usr/lib/ruby/vendor_ruby/chef/run_context.rb:207:inload_resource_definitions'
/usr/lib/ruby/vendor_ruby/chef/run_context.rb:230:in call' /usr/lib/ruby/vendor_ruby/chef/run_context.rb:230:inforeach_cookbook_load_segment'
/usr/lib/ruby/vendor_ruby/chef/run_context.rb:229:in each' /usr/lib/ruby/vendor_ruby/chef/run_context.rb:229:inforeach_cookbook_load_segment'
/usr/lib/ruby/vendor_ruby/chef/run_context.rb:227:in each' /usr/lib/ruby/vendor_ruby/chef/run_context.rb:227:inforeach_cookbook_load_segment'
/usr/lib/ruby/vendor_ruby/chef/run_context.rb:203:in load_resource_definitions' /usr/lib/ruby/vendor_ruby/chef/run_context.rb:66:inload'
/usr/lib/ruby/vendor_ruby/chef/client.rb:198:in setup_run_context' /usr/lib/ruby/vendor_ruby/chef/client.rb:418:indo_run'
/usr/lib/ruby/vendor_ruby/chef/client.rb:176:in run' /usr/lib/ruby/vendor_ruby/chef/application.rb:140:inrun_chef_client'
/usr/lib/ruby/vendor_ruby/chef/application/solo.rb:224:in run_application' /usr/lib/ruby/vendor_ruby/chef/application/solo.rb:216:inloop'
/usr/lib/ruby/vendor_ruby/chef/application/solo.rb:216:in run_application' /usr/lib/ruby/vendor_ruby/chef/application.rb:72:inrun'
/usr/bin/chef-solo:24

Relevant File Content:

/tmp/chef-solo/site-cookbooks/postgresql/definitions/pg_database.rb:

1>> define :pg_database, action: :create do
2:
3: defaults = {
4: user: "postgres",
5: username: nil,
6: host: nil,
7: port: nil,
8: encoding: "utf8",
9: locale: nil,
10: template: nil,

Recipe Compile Error in /tmp/chef-solo/site-cookbooks/postgresql/definitions/pg_database_extensions.rb

SyntaxError

compile error
/tmp/chef-solo/site-cookbooks/postgresql/definitions/pg_database_extensions.rb:1: syntax error, unexpected ':', expecting $end
define :pg_database_extensions, action: :create do
^

Cookbook Trace:

/tmp/chef-solo/site-cookbooks/postgresql/definitions/pg_database_extensions.rb:1:in from_file' /usr/lib/ruby/vendor_ruby/chef/run_context.rb:207:inload_resource_definitions'
/usr/lib/ruby/vendor_ruby/chef/run_context.rb:230:in call' /usr/lib/ruby/vendor_ruby/chef/run_context.rb:230:inforeach_cookbook_load_segment'
/usr/lib/ruby/vendor_ruby/chef/run_context.rb:229:in each' /usr/lib/ruby/vendor_ruby/chef/run_context.rb:229:inforeach_cookbook_load_segment'
/usr/lib/ruby/vendor_ruby/chef/run_context.rb:227:in each' /usr/lib/ruby/vendor_ruby/chef/run_context.rb:227:inforeach_cookbook_load_segment'
/usr/lib/ruby/vendor_ruby/chef/run_context.rb:203:in load_resource_definitions' /usr/lib/ruby/vendor_ruby/chef/run_context.rb:66:inload'
/usr/lib/ruby/vendor_ruby/chef/client.rb:198:in setup_run_context' /usr/lib/ruby/vendor_ruby/chef/client.rb:418:indo_run'
/usr/lib/ruby/vendor_ruby/chef/client.rb:176:in run' /usr/lib/ruby/vendor_ruby/chef/application.rb:140:inrun_chef_client'
/usr/lib/ruby/vendor_ruby/chef/application/solo.rb:224:in run_application' /usr/lib/ruby/vendor_ruby/chef/application/solo.rb:216:inloop'
/usr/lib/ruby/vendor_ruby/chef/application/solo.rb:216:in run_application' /usr/lib/ruby/vendor_ruby/chef/application.rb:72:inrun'
/usr/bin/chef-solo:24

Relevant File Content:

/tmp/chef-solo/site-cookbooks/postgresql/definitions/pg_database_extensions.rb:

1>> define :pg_database_extensions, action: :create do
2:
3: dbname = params[:name]
4: languages = Array(params[:languages]) # Allow single value or array of values
5: extensions = Array(params[:extensions])
6: postgis = params[:postgis]
7:
8: case params[:action]
9: when :create
10:

Recipe Compile Error in /tmp/chef-solo/site-cookbooks/postgresql/definitions/pg_user.rb

SyntaxError

compile error
/tmp/chef-solo/site-cookbooks/postgresql/definitions/pg_user.rb:1: syntax error, unexpected ':', expecting $end
define :pg_user, action: :create do
^

Cookbook Trace:

/tmp/chef-solo/site-cookbooks/postgresql/definitions/pg_user.rb:1:in from_file' /usr/lib/ruby/vendor_ruby/chef/run_context.rb:207:inload_resource_definitions'
/usr/lib/ruby/vendor_ruby/chef/run_context.rb:230:in call' /usr/lib/ruby/vendor_ruby/chef/run_context.rb:230:inforeach_cookbook_load_segment'
/usr/lib/ruby/vendor_ruby/chef/run_context.rb:229:in each' /usr/lib/ruby/vendor_ruby/chef/run_context.rb:229:inforeach_cookbook_load_segment'
/usr/lib/ruby/vendor_ruby/chef/run_context.rb:227:in each' /usr/lib/ruby/vendor_ruby/chef/run_context.rb:227:inforeach_cookbook_load_segment'
/usr/lib/ruby/vendor_ruby/chef/run_context.rb:203:in load_resource_definitions' /usr/lib/ruby/vendor_ruby/chef/run_context.rb:66:inload'
/usr/lib/ruby/vendor_ruby/chef/client.rb:198:in setup_run_context' /usr/lib/ruby/vendor_ruby/chef/client.rb:418:indo_run'
/usr/lib/ruby/vendor_ruby/chef/client.rb:176:in run' /usr/lib/ruby/vendor_ruby/chef/application.rb:140:inrun_chef_client'
/usr/lib/ruby/vendor_ruby/chef/application/solo.rb:224:in run_application' /usr/lib/ruby/vendor_ruby/chef/application/solo.rb:216:inloop'
/usr/lib/ruby/vendor_ruby/chef/application/solo.rb:216:in run_application' /usr/lib/ruby/vendor_ruby/chef/application.rb:72:inrun'
/usr/bin/chef-solo:24

Relevant File Content:

/tmp/chef-solo/site-cookbooks/postgresql/definitions/pg_user.rb:

1>> define :pg_user, action: :create do
2: case params[:action]
3: when :create
4: privileges = {
5: superuser: false,
6: createdb: false,
7: login: true
8: }
9: privileges.merge! params[:privileges] if params[:privileges]
10:

@phlipper
Copy link
Owner

@joeypdx what version of Ruby and Chef are you using? This is currently working for me with the latest omnibus Chef install and chef-solo with Vagrant. This cookbook requires Ruby 1.9, 1.8 won't work. I will update the README with a note that reflects this.

@dvfabbri
Copy link

I also get this error using Ruby 1.9.

@phlipper
Copy link
Owner

@dvfabbri thanks for the report. What version of Chef and what version of Ruby are you using? I did update the syntax from 1.8-style to 1.9-style hashes between 0.11.3 and 0.12.0 of this cookbook, but I am currently using this in production in several places with Chef 11.4.4 and 11.6.0 via Ruby 1.9.3 without issue.

Let me know, I'd like to help you debug this issue. Thanks.

@dvfabbri
Copy link

Chef 10.14.2 and ruby 1.9.3. Perhaps I need to update chef. I am just using
what was packaged with the latest download of vagrant.

On Thu, Sep 26, 2013 at 11:31 PM, Phil Cohen notifications@github.comwrote:

@dvfabbri https://github.com/dvfabbri thanks for the report. What
version of Chef and what version of Ruby are you using? I did update the
syntax from 1.8-style to 1.9-style hashes between 0.11.3 and 0.12.0 of this
cookbook, but I am currently using this in production in several places
with Chef 11.4.4 and 11.6.0 via Ruby 1.9.3 without issue.

Let me know, I'd like to help you debug this issue. Thanks.


Reply to this email directly or view it on GitHubhttps://github.com//issues/49#issuecomment-25222179
.

@phlipper
Copy link
Owner

@dvfabbri thanks for the information. I have been using the vagrant-omnibus plugin recently to integrate Chef with Vagrant. My Vagrantfile (using Vagrant 1.2.7) is bootstrapped with the following:

Vagrant.require_plugin("vagrant-omnibus")

Vagrant.configure("2") do |config|
  config.omnibus.chef_version = :latest
  # ...
end

If you get a chance, please give that a try an let me know how it turns out. I'm hoping this issue is just version related. If not, I'm happy to work to get it resolved. Thanks for your time and patience!

@heffergm
Copy link

So I unfortunately ran into this today using opsworks, and have come to find out that they bootstrap (and only support) with 1.8.7. So for now, I've forked and just reverted the 1.9.3 specific changes.

I'll try and stay in sync with your upstream changes as long as possible ;)

@misham
Copy link

misham commented Dec 24, 2013

Saw the same issue with 2c412e2

I have omnibus set to :latest but on vagrant provision was seeing chef 10.14.2 being pulled in for some reason.

Ran vagrant destroy -f && vagrant up, which seems to have fixed the issue.

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

5 participants