Bug in ln_s I think.

1 view
Skip to first unread message

Tim Uckun

unread,
Nov 11, 2009, 8:30:26 PM11/11/09
to autom...@googlegroups.com
this line

ln_s "/var/www/nova/current/logrotate/production",
"/etc/logrotate.d/nova_production_log"

is throwing up an exception. I suspect the reason it's throwing up an
error is because the source file does not exist (yet). I don't know if
you wanted this behavior or not but if you did perhaps a a better
error message is in order.

ln_sf does not throw up the error and creates the symlinks OK.


** ln -s /var/www/nova/current/logrotate/production
/etc/logrotate.d/nova_production_log
Rewrite this to email the errors and to report to zabbix
Problem with recipe 'recipes/__init__.rb' at line 13

7 invoke 'automateit'
8
9 #this uses the facter gem to loads facts into a global mash.
10 # facts can be added in there...
11
12
* 13 invoke Facts.hostname
14
15 rescue => e

(AutomateIt::Error) Problem with recipe 'recipes/__init__.rb' at line 13

7 invoke 'automateit'
8
9 #this uses the facter gem to loads facts into a global mash.
10 # facts can be added in there...
11
12
* 13 invoke Facts.hostname
14
15 rescue => e

(Errno::EEXIST) File exists -
/var/www/nova/current/logrotate/production or
/etc/logrotate.d/nova_production_log
/usr/lib/ruby/1.8/fileutils.rb:338:in `symlink'
/usr/lib/ruby/1.8/fileutils.rb:338:in `ln_s'
/usr/lib/ruby/1.8/fileutils.rb:1411:in `fu_each_src_dest0'
/usr/lib/ruby/1.8/fileutils.rb:336:in `ln_s'
gems/automateit_src/lib/automateit/shell_manager/base_link.rb:76:in `send'
gems/automateit_src/lib/automateit/shell_manager/base_link.rb:76:in `_ln'
gems/automateit_src/lib/automateit/shell_manager/symlink.rb:25:in `ln_s'
(eval):2:in `send'
(eval):2:in `ln_s'
recipes/nova.rb:35:in `invoke'
gems/automateit_src/lib/automateit/interpreter.rb:406:in `each'
gems/automateit_src/lib/automateit/interpreter.rb:406:in `invoke'
recipes/ubuntuvm01.rb:7:in `invoke'
gems/automateit_src/lib/automateit/interpreter.rb:406:in `each'
gems/automateit_src/lib/automateit/interpreter.rb:406:in `invoke'
recipes/__init__.rb:13:in `invoke'
gems/automateit_src/lib/automateit/interpreter.rb:493:in `invoke'
gems/automateit_src/lib/automateit/interpreter.rb:406:in `each'
gems/automateit_src/lib/automateit/interpreter.rb:406:in `invoke'
recipes/ubuntuvm01.rb:7:in `invoke'
gems/automateit_src/lib/automateit/interpreter.rb:406:in `each'
gems/automateit_src/lib/automateit/interpreter.rb:406:in `invoke'
recipes/__init__.rb:13:in `invoke'
/opt/automate/gems/automateit_src/lib/automateit/interpreter.rb:493:in
`invoke'/opt/automate/gems/automateit_src/lib/automateit/interpreter.rb:406:in
`each'/opt/automate/gems/automateit_src/lib/automateit/interpreter.rb:406:in
`invoke'recipes/__init__.rb:13:in
`invoke'/opt/automate/gems/automateit_src/lib/automateit/interpreter.rb:406:in
`each'/opt/automate/gems/automateit_src/lib/automateit/interpreter.rb:406:in
`invoke'/opt/automate/gems/automateit_src/lib/automateit/interpreter.rb:389:in
`invoke'/opt/automate/gems/automateit_src/lib/automateit/root.rb:15:in
`invoke'/opt/automate/gems/automateit_src/lib/automateit/cli.rb:39:in
`run'./gems/automateit_src/bin/automateit:123/usr/lib/ruby/1.8/optparse.rb:787:in
`initialize'./gems/automateit_src/bin/automateit:35:in
`new'./gems/automateit_src/bin/automateit:35

Igal Koshevoy

unread,
Nov 11, 2009, 8:44:54 PM11/11/09
to autom...@googlegroups.com
Thanks for the report.

I think that's intended behavior, not a bug. The "File exists" exception
means that it couldn't create a symlink because there was a file or link
at the target location already, although not pointing at the desired
place. The "ln_s" and "ln_sf" commands deal with this situation differently:
- "ln_s" is a non-destructive command, it only adds a link if needed or
ensures that the link points to the right place.
- "ln_sf" is a destructive command, it ads a link if needed even if it
means destroying something.

Does that make sense?

As for error context showing where you got the exception in the recipe,
ugh, looks like there's a bug there because it should have only
displayed that once, not twice. I'll add that the next bugfix.

-igal
> --
>
> You received this message because you are subscribed to the Google Groups "AutomateIt" group.
> To post to this group, send email to autom...@googlegroups.com.
> To unsubscribe from this group, send email to automateit+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/automateit?hl=.
>
>
>

Reply all
Reply to author
Forward
0 new messages