Erb Syntax Error Unexpected $end Expecting Kend
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the syntax error unexpected end expecting keyword_end workings and policies of this site About Us Learn more about Stack syntax error unexpected end expecting t_function Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs ruby syntax error unexpected end expecting keyword_end Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join
Syntax Error Unexpected End Expecting Between Or In Or Sql_token_like
them; it only takes a minute: Sign up Why is this an error with ERB? up vote 5 down vote favorite 1
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack erb new Overflow the company Business Learn more about hiring developers or posting ads with us
Erb Templates
Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community
Ruby Erb
of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Ruby unexpected kEND, expecting $end up vote 1 down vote favorite require 'open-uri' print "Enter a http://stackoverflow.com/questions/17374274/why-is-this-an-error-with-erb URL" add = gets open(#{add}) do |f| j = f.read.scan(/http://stackoverflow.com/questions/10078316/ruby-unexpected-kend-expecting-end the file, but I found an end instead." –Phrogz Apr 9 '12 at 19:08 add a comment| 2 Answers 2 active oldest votes up vote 5 down vote accepted #{} works only inside interpolated strings. Use open(add) (or perfectly correct, but perfectly unnecessary open("#{add}")). share|improve this answer answered Apr 9 '12 at 19:06 Amadan 90.7k885133 add a comment| up vote 4 down vote On this line: open(#{add}) do |f| You are trying to use #{} to interpolate a variable into a string, but outside of a string. The # is being interpreted as the start of the comment, and the rest of the line is treated as a comment. You can just use add directly here, without any string interpolation. share|improve this answer answered Apr 9 '12 at 19:08 Brian Campbell 163k37259290 I do find it a little odd that the lexer was looking for $end instead of a right paren. –Phrogz Apr 9 '12 at 19:20 @Phrogz When I tested this out with a similar program, I got an error about the missing paren, and an error about $end. I am assuming that the first error gets the parser confused, and so the second error is spurious. –Brian Campbell Apr 9 '12 at 23:20 add a commen
från GoogleLogga inDolda fältSök efter grupper eller meddelanden
expecting $end edit template puppet end asked 2015-01-27 07:59:27 -0500 wingZero 33 ●4 ●5 ●10 updated 2015-01-27 22:09:58 -0500 GregLarkin 4832 ●5 ●17 ●62 http://www.puppet.com/ Hi, I am getting this error with the below syntax, any idea what I need to do to get this working? The ruby I believe seems ok. Details: <% if definition == "someserver" -%> $ModLoad imfile.so <% i = exec( "date +%Y_%m_%d" ) -%> $InputFileName /data/logs/weblogs/jetty-<%= i -%>.request.log <% end -%> Log anything (except mail) of level info or higher. Don't log private authentication messages! *.info;mail.none;authpriv.none;cron.none;local7.none /var/log/messages <% end -%> edit retag flag offensive close merge delete CommentsIs that all to your code? From that error it looks like it is expecting another <% end %> statement - any other loops/ifs/etc that aren't in the above snippet?lorcutt( 2015-01-27 11:07:02 -0500 )editHi, There are things further below, but nothing above that as its at the top of the file. If I remove this bit the template runs fine.wingZero( 2015-01-27 15:23:47 -0500 )edit1It looks like you have unbalanced end statements, but it would be helpful if you posted a link to a pastebin of the complete file. Otherwise, it may be difficult to tell exactly why the error occurs.GregLarkin( 2015-01-27 22:14:17 -0500 )editHi, Added the full file. http://pastebin.com/tEv64qnVwingZero( 2015-01-28 01:53:35 -0500 )editadd a comment 1 answer Sort by » oldest newest most voted 1 answered 2015-01-28 11:11:45 -0500 GregLarkin 4832 ●5 ●17 ●62 http://www.puppet.com/ Looking at your full source code, it appears that you have an unbalanced end statement in your Ruby code. Remove the unbalanced one, and you should be all set. edit flag offensive delete link more add a comment Your Answer Please start posting anonymously - your entry will be published after you log in or create a new account. Add Answer Question Tools Follow 1 follower subscribe to rss feed Stats Asked: 2015-01-27 07:59:27 -0500 Seen: 474 times Last updated: Jan 28 '15 Related questions Puppet agent slow on "Starting connection for https://puppet:8140" Could not find class india for puppetmaster Trouble understanding how to use example42/splunk refreshonly on exec resource not working on file change camptocamp-accounts, hiera client report to motd how does one