How to avoid false positive "failed" (by linked_dirs task)

45 views
Skip to first unread message

Jan Reges

unread,
Mar 26, 2015, 6:56:11 AM3/26/15
to capis...@googlegroups.com
Hi,

I use latest Capistrano version 3.4.0.

It's confusing for us, that Capistrano result shows red "failed" when testing symlinks existence before its creation.

Expected result is - when there are no critical/unexpected issues, there are only "successful" messages. When somebody run deploy, these "failed" messages looks like an important failure.

Do you have a simple/clean solution to this? Or I have to override whole task "linked_dirs" in my deploy.rb?

Thank you.

EXAMPLE:

DEBUG [fb21d8fd] Running /usr/bin/env [ -L /www/PROJECT/releases/20150326101046/log/access-denied ] as re...@10.234.1.33
DEBUG [fb21d8fd] Command: [ -L /www/PROJECT/releases/20150326101046/log/access-denied ]
DEBUG [fb21d8fd] Finished in 0.059 seconds with exit status 1 (failed).

CODE in deploy.rake:

task :linked_dirs do
   
next unless any? :linked_dirs
    on release_roles
:all do
    execute
:mkdir, '-p', linked_dir_parents(release_path)


    fetch
(:linked_dirs).each do |dir|
        target
= release_path.join(dir)
        source
= shared_path.join(dir)
       
unless test "[ -L #{target} ]"
       
if test "[ -d #{target} ]"
          execute
:rm, '-rf', target
       
end
        execute
:ln, '-s', source, target
     
end
   
end
 
end
end

Lee Hambley

unread,
Mar 26, 2015, 7:42:07 AM3/26/15
to Capistrano
It's not a false positive Jan, the `test` command returns exit status 1 which is a "failure to find this thing as a symlink"… we always walk the boundary between an arguably sane language (Ruby) and some arcane weird old Unix topics. You could try inverting the test (i.e I suceeded !finding the thing as a symlink) and submit a PR if everything still works.

You're the 2nd person in about 12 months to ask about this, so whilst it can certainly be confusing, I do think there's an element of valuable "why is that failing… ohh it's just the way the underlying shell works" education and knowledge sharing here.

--
You received this message because you are subscribed to the Google Groups "Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capistrano+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/capistrano/cebef553-aa49-4a90-83dd-5ca72ed3ed2a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jan Reges

unread,
Mar 26, 2015, 8:55:18 AM3/26/15
to capis...@googlegroups.com
Hi Lee,

thank you for your answer.

I use Capistrano only few weeks and I integrate it into our company workflow.

When somebody (who is not a guru) run a deploy and there are some red failed rows, of course, he comes to me and asks, why it failed.

So, imho, when whole deployment process works properly (and capistrano handles all expected situations), all records have to be successful.

Capistrano is great tool. It's just my opinion and I will strive to ensure that in our deploy process, there will not be confusing "failed" records, when everything works fine as expected :-))

If I find an elegant solution how to fix it, i'll send PR.

Dne čtvrtek 26. března 2015 12:42:07 UTC+1 Lee Hambley napsal(a):
Reply all
Reply to author
Forward
0 new messages