2016-01-29 1 views
1

Ma provision de vagabond échoue quand chef-solo essaie de démarrer le pare-feu AFW - enquête montre que le fichier /etc/init.d/firewall a^M caractères à la fin de chaque ligne.Windows Vagabond chef-solo provision crée CRLF dans Linux invité

sortie du journal de la provision est:

Compiled Resource: 
==> default: ------------------ 
==> default: # Declared in /tmp/vagrant-chef-solo/65fec65b9f544271ce41fa26d9a1fc6f/cookbooks/afw/recipes/default.rb:85:in `from_file' 
==> default: 
==> default: service("firewall") do 
==> default: action [:enable, :start] 
==> default: supports {:restart=>false, :reload=>false, :status=>true} 
==> default: retries 0 
==> default: retry_delay 2 
==> default: service_name "firewall" 
==> default: enabled true 
==> default: pattern "firewall" 
==> default: startup_type :automatic 
==> default: cookbook_name :afw 
==> default: recipe_name "default" 
==> default: end 
==> default: 

Cela ne se produit pas pour tout autre fichier créé.

AFW est chargé à partir d'une autre recette

Vagrant fichier:

project_directory = Dir.pwd.split(File::SEPARATOR)[-3]  

VAGRANTFILE_API_VERSION = "2" 

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 
    # All Vagrant configuration is done here. The most common configuration 
    # options are documented and commented below. For a complete reference, 
    # please see the online documentation at vagrantup.com. 

    # Every Vagrant virtual environment requires a box to build off of. 

    config.vm.box = "CentOS-6.5-x86_64-virtualbox-minimal-0.1.1.box" 
    config.vm.box_url = "http://ib-vagrant-vms.s3.amazonaws.com/CentOS-6.5-x86_64-virtualbox-minimal-0.1.1.box" 

    # Boot with a GUI so you can see the screen. (Default is headless) 
    # config.vm.boot_mode = :gui 

    config.vm.host_name = "XXXXX.development.local" 
    config.hostsupdater.aliases = [ 
    "YYYYY.development.local", 
    ] 

    # Assign this VM to a host-only network IP, allowing you to access it 
    # via the IP. Host-only networks can talk to the host machine as well as 
    # any other machines on the same network, but cannot be accessed (through this 
    # network interface) by any external networks. 
    config.vm.network :private_network, ip: "192.168.1.11" 

    config.vm.provider :virtualbox do |vb| 
    vb.gui = false 
    vb.name = "New Server" 
    vb.memory = "2048" 
    end 

    # Assign this VM to a bridged network, allowing you to connect directly to a 
    # network using the host's network device. This makes the VM appear as another 
    # physical device on your network. 
    # config.vm.network :bridged 

    # Forward a port from the guest to the host, which allows for outside 
    # computers to access the VM, whereas host only networking does not. 
    # config.vm.forward_port 80, 8080 

    # Share an additional folder to the guest VM. The first argument is 
    # an identifier, the second is the path on the guest to mount the 
    # folder, and the third is the path on the host to the actual folder. 
    # config.vm.share_folder "v-data", "/vagrant_data", "../data" 

    # The following configuration supports shared folders with host 
    # aware configuration of NFS for performance benefits on unix based hosts 
    require 'ffi' 
    config.vm.synced_folder "../../", File.join("/mnt/Sites", project_directory), :nfs => ! FFI::Platform::IS_WINDOWS 

    # Enable the cachier plugin if available, so we can cache composer dependencies, yum packages, etc. 
    if Vagrant.has_plugin?("vagrant-cachier") 
    # Configure cached packages to be shared between instances of the same base box. 
    # More info on http://fgrehm.viewdocs.io/vagrant-cachier/usage 
config.cache.scope = :box 

    if ! FFI::Platform::IS_WINDOWS then 
     # OPTIONAL: If you are using VirtualBox, you might want to use that to enable 
     # NFS for shared folders. This is also very useful for vagrant-libvirt if you 
     # want bi-directional sync 
     config.cache.synced_folder_opts = { 
     type: :nfs, 
     # The nolock option can be useful for an NFSv3 client that wants to avoid the 
     # NLM sideband protocol. Without this option, apt-get might hang if it tries 
     # to lock files needed for /var/cache/* operations. All of this can be avoided 
     # by using NFSv4 everywhere. Please note that the tcp option is not the default. 
     mount_options: ['rw', 'vers=3', 'tcp', 'nolock'] 
     } 
    end 

    config.cache.enable :composer 
    config.cache.enable :chef 
    config.cache.enable :generic, { 
     rbenv: { 
     cache_dir: '/usr/local/rbenv' 
     } 
    } 
    end 

    # Enable provisioning with chef solo, specifying a cookbooks path, roles 
    # path, and data_bags path (all relative to this Vagrantfile), and adding 
    # some recipes and/or roles. 
    # 
    if Vagrant.has_plugin?("vagrant-berkshelf") 
    config.berkshelf.enabled = true 
    config.berkshelf.berksfile_path = "../chef/Berksfile" 
    end 

    config.vm.provision :chef_solo do |chef| 
    # logging 
    chef.log_level = :debug 
    chef.arguments = '--force-formatter' 


    if ! FFI::Platform::IS_WINDOWS then 
     # Mount chef folders via NFS for speed 
     chef.synced_folder_type = 'nfs' 
    end 

    if Vagrant::VERSION.to_f > 1.0 
     chef.provisioning_path = "/tmp/vagrant-chef-solo" 
     if !Vagrant.has_plugin?("vagrant-cachier") then 
     chef.file_cache_path = chef.provisioning_path 
     end 
    end 

    chef.cookbooks_path = ["../chef/cookbooks", "../chef/site-cookbooks"] 
    chef.roles_path = "../chef/roles" 
    chef.environments_path = "../chef/environments" 

    chef.environment = "dev" 

    chef.data_bags_path = ["../chef/data_bags/"] 

    # Uncomment the following line and copy in the encryption key if you need to work 
    # with encrypted data bag data in your local environment 
    chef.encrypted_data_bag_secret_key_path = "../chef/.chef/#{chef.environment}_encrypted_data_bag_secret" 

    chef.add_recipe "data-bag-merge::environment" 
    chef.add_recipe "yum-ius-XXXXX" 
    chef.add_role "base" 
    chef.add_recipe "resolver" 
    chef.add_role "mysql-server-56" 
    chef.add_recipe "database-XXXXX" 
    chef.add_role "self-signed-ssl" 
    chef.add_role "ssl-offloading-server" 
    chef.add_role "memcached" 
    chef.add_role "redis" 
    chef.add_role "varnish" 
    chef.add_role "solr-server" 
    chef.add_role "admin-server" 
    chef.add_role "api-server" 
    chef.add_role "developer" 
    chef.add_role 'maintenance' 

    #add chef attributes that rely on project_directory variable 
    chef.json = { 
     'resolver' => { 
     'nameservers' => ['8.8.8.8', '8.8.4.4'] 
     }, 
     'xdebug' => { 
     'is_extension_enabled' => true 
     }, 
    } 
    end 
end 

Répondre

0

Parce que je d'abord couru la commande vagrant up --provisiongit avait téléchargé toutes les dépendances de livres de cuisine à mon lecteur local et avait mis CRLF s en les fichiers texte qu'il avait téléchargés.

Set autocrlf=input dans le fichier gitconfig dans:

c:\users\JonM\Appdata\local\GitHub\portablegit'''''\etc 

supprimer tous les livres de cuisine téléchargés sous:

c:\users\JonM\.berkshelf\cookbooks` 

Run

vagrant up --provision 

encore et tous les livres de cuisine sont téléchargés à nouveau - cette temps sans le CRLF.