Windows vagrant chef-solo provision creates CRLF in Linux guest -


my vagrant provision fails when chef-solo tries start afw firewall - investigation shows /etc/init.d/firewall file has ^m characters on end of each line.

output provision log is:

 compiled resource: ==> default: ------------------ ==> default: # declared in /tmp/vagrant-chef-solo/65fec65b9f544271ce41fa26d9a1fc6f/cookbooks/afw/recipes/default.rb:85:in `from_file' ==> default: ==> default: service("firewall") ==> 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: 

this doesn't happen other created file.

afw loaded recipe

vagrant file:

project_directory = dir.pwd.split(file::separator)[-3]      vagrantfile_api_version = "2"  vagrant.configure(vagrantfile_api_version) |config|   # vagrant configuration done here. common configuration   # options documented , commented below. complete reference,   # please see online documentation @ vagrantup.com.    # every vagrant virtual environment requires box 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 gui can see screen. (default headless)   # config.vm.boot_mode = :gui    config.vm.host_name = "xxxxx.development.local"   config.hostsupdater.aliases = [     "yyyyy.development.local",   ]    # assign vm host-only network ip, allowing access   # via ip. host-only networks can talk host machine   # other machines on same network, cannot accessed (through   # network interface) external networks.   config.vm.network :private_network, ip: "192.168.1.11"    config.vm.provider :virtualbox |vb|     vb.gui = false     vb.name = "new server"     vb.memory = "2048"   end    # assign vm bridged network, allowing connect directly   # network using host's network device. makes vm appear   # physical device on network.   # config.vm.network :bridged    # forward port guest host, allows outside   # computers access vm, whereas host networking not.   # config.vm.forward_port 80, 8080    # share additional folder guest vm. first argument   # identifier, second path on guest mount   # folder, , third path on host actual folder.   # config.vm.share_folder "v-data", "/vagrant_data", "../data"    # following configuration supports shared folders host   # aware configuration of nfs performance benefits on unix based hosts   require 'ffi'   config.vm.synced_folder "../../", file.join("/mnt/sites", project_directory), :nfs => ! ffi::platform::is_windows    # enable cachier plugin if available, can cache composer dependencies, yum packages, etc.   if vagrant.has_plugin?("vagrant-cachier")     # configure cached packages shared between instances of same base box.     # more info on http://fgrehm.viewdocs.io/vagrant-cachier/usage config.cache.scope = :box      if ! ffi::platform::is_windows       # optional: if using virtualbox, might want use enable       # nfs shared folders. useful vagrant-libvirt if       # want bi-directional sync       config.cache.synced_folder_opts = {          type: :nfs,         # nolock option can useful nfsv3 client wants avoid         # nlm sideband protocol. without option, apt-get might hang if tries         # lock files needed /var/cache/* operations. of can avoided         # using nfsv4 everywhere. please note tcp option not 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 chef solo, specifying cookbooks path, roles    # path, , data_bags path (all relative vagrantfile), , adding    # 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 |chef|     # logging     chef.log_level = :debug     chef.arguments = '--force-formatter'       if ! ffi::platform::is_windows       # mount chef folders via nfs 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")         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 following line , copy in encryption key if need work     # encrypted data bag data in 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 rely on project_directory variable     chef.json = {       'resolver' => {       'nameservers' => ['8.8.8.8', '8.8.4.4']       },       'xdebug' => {         'is_extension_enabled' => true       },     }   end end 

because i'd ran vagrant --provision command git had downloaded cookbook dependencies local drive , had put crlfs in text files had downloaded.

set autocrlf=input in gitconfig file in:

c:\users\jonm\appdata\local\github\portablegit'''''\etc 

delete downloaded cookbooks under:

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

run

vagrant --provision 

again , cookbooks downloaded again - time without crlf.


Comments