阻止厨师创建递归符号链接

时间:2014-05-09 08:59:58

标签: chef chef-recipe

我将deploy资源与symlink_before_migrate({'folder' => 'folder'})一起使用,并且正确地将current/foldershared/folder相关联,但也创建了链接到shared/folder/folder的链接shared/folder

ls -alh /proj_dir/current/folder/
drwxrwxr-x 2 ubuntu ubuntu 4.0K May  9 07:39 .
drwxrwxr-x 9 ubuntu ubuntu 4.0K May  9 07:39 ..
-rw-rw---- 1 ubuntu ubuntu 1.2K May  9 07:39 file1
-rw-rw---- 1 ubuntu ubuntu 1.3K May  9 07:39 file2
lrwxrwxrwx 1 ubuntu ubuntu   41 May  9 07:39 folder -> /proj_dir/shared/folder

如何阻止Chef创建递归符号链接?

---- ----- EDIT

 deploy "#{project_dir}" do
    repo "git@github.com:company/project.git"
    branch environment == "production" ? "master" : "staging"
    action :deploy
    user "ubuntu"
    group "ubuntu"
    environment({ "RAILS_ENV" => environment })

    symlink_before_migrate.clear
    symlink_before_migrate({"config/aws.yml" => "config/aws.yml",
                             "config/database.yml" => "config/database.yml",
                             "config/integrations.yml" => "config/integrations.yml",
                             "public/assets" => "public/assets",
                             "public/robots.txt" => "public/robots.txt",
                             "public/blog" => "public/blog"})
    before_symlink do
      rvm_shell "run bundle install for #{node['rvm']['default_ruby']}" do
        user "ubuntu"
        ruby_string node['rvm']['default_ruby']
        code "bundle install --gemfile #{release_path}/Gemfile --path #{project_dir}/shared/bundle --deployment --quiet --without development test"
      end
      rvm_shell "rake db:migrate" do
        user "ubuntu"
        ruby_string node['rvm']['default_ruby']
    cwd "#{release_path}"
        code "cd #{release_path} && RAILS_ENV=#{environment} bundle exec rake db:migrate"
        only_if {node.role?("run_migrations")}
      end
    end
    before_restart do
      rvm_shell "run rake assets:precompile" do
        user "ubuntu"
        ruby_string node['rvm']['default_ruby']
    cwd "#{release_path}"
        code "RAILS_ENV=#{environment} bundle exec rake assets:precompile"
      end
    end

0 个答案:

没有答案