繁体   English   中英

无业游民提供在Windows上不起作用,但在Ubuntu上起作用

[英]vagrant provisining don't work on Windows but work on Ubuntu

我有vagrant / puppet提供脚本,当我的主机是Windows时(在Ubuntu上托管似乎没有此问题)时看到了一个问题。 我可以看到使用apache ports.conf文件的apache :: concat有问题。 我在两个地方(Ubuntu服务器14.04)都使用了相同的来宾盒。 据我所知,木偶正在来宾计算机上运行。

我的问题是,为什么在置备期间出现此警告和错误?

==> default: Running provisioner: puppet...
==> default: Running Puppet with default.pp...
==> default: stdin: is not a tty
==> default: Notice: Compiled catalog for eclectic.vm in environment production in 7.06 seconds
==> default: Notice: /Stage[main]/Main/Exec[apt-update]/returns: executed successfully
==> default: Notice: /Stage[main]/Main/Exec[git-checkout-drush]/returns: executed successfully
==> default: Notice: /Stage[main]/Main/File[/var/www/vhosts/eclectic.ca]/mode: mode changed '0777' to '0775'
==> default: Notice: /Stage[main]/Main/Apache::Vhost[ca.eclectic.vm]/File[/var/www/vhosts/eclectic.ca/public_html]/owner: owner changed 'www-data' to 'root'
==> default: Notice: /Stage[main]/Main/Apache::Vhost[ca.eclectic.vm]/File[/var/www/vhosts/eclectic.ca/public_html]/group: group changed 'vagrant' to 'root'
==> default: Error: /Stage[main]/Apache/Concat[/etc/apache2/ports.conf]/Exec[concat_/etc/apache2/ports.conf]: Could not evaluate: /usr/bin/env: ruby
: No such file or directory
==> default: Notice: /Stage[main]/Apache/Concat[/etc/apache2/ports.conf]/File[/etc/apache2/ports.conf]: Dependency Exec[concat_/etc/apache2/ports.conf] has failures: true
==> default: Warning: /Stage[main]/Apache/Concat[/etc/apache2/ports.conf]/File[/etc/apache2/ports.conf]: Skipping because of failed dependencies
==> default: Notice: /Stage[main]/Main/Exec[composer-install-drush]/returns: executed successfully
==> default: Error: /Stage[main]/Main/Apache::Vhost[ssl-ca.eclectic.vm]/Concat[25-ssl-ca.eclectic.vm.conf]/Exec[concat_25-ssl-ca.eclectic.vm.conf]: Could not evaluate: /usr/bin/env: ruby
: No such file or directory
==> default: Notice: /Stage[main]/Main/Apache::Vhost[ssl-ca.eclectic.vm]/Concat[25-ssl-ca.eclectic.vm.conf]/File[25-ssl-ca.eclectic.vm.conf]: Dependency Exec[concat_25-ssl-ca.eclectic.vm.conf] has failures: true
==> default: Warning: /Stage[main]/Main/Apache::Vhost[ssl-ca.eclectic.vm]/Concat[25-ssl-ca.eclectic.vm.conf]/File[25-ssl-ca.eclectic.vm.conf]: Skipping because of failed dependencies
==> default: Notice: /Stage[main]/Main/Apache::Vhost[ssl-ca.eclectic.vm]/File[25-ssl-ca.eclectic.vm.conf symlink]: Dependency Exec[concat_25-ssl-ca.eclectic.vm.conf] has failures: true
==> default: Warning: /Stage[main]/Main/Apache::Vhost[ssl-ca.eclectic.vm]/File[25-ssl-ca.eclectic.vm.conf symlink]: Skipping because of failed dependencies
==> default: Error: /Stage[main]/Main/Apache::Vhost[ca.eclectic.vm]/Concat[25-ca.eclectic.vm.conf]/Exec[concat_25-ca.eclectic.vm.conf]: Could not evaluate: /usr/bin/env: ruby
: No such file or directory
==> default: Notice: /Stage[main]/Main/Apache::Vhost[ca.eclectic.vm]/Concat[25-ca.eclectic.vm.conf]/File[25-ca.eclectic.vm.conf]: Dependency Exec[concat_25-ca.eclectic.vm.conf] has failures: true
==> default: Warning: /Stage[main]/Main/Apache::Vhost[ca.eclectic.vm]/Concat[25-ca.eclectic.vm.conf]/File[25-ca.eclectic.vm.conf]: Skipping because of failed dependencies
==> default: Notice: /Stage[main]/Main/Apache::Vhost[ca.eclectic.vm]/File[25-ca.eclectic.vm.conf symlink]: Dependency Exec[concat_25-ca.eclectic.vm.conf] has failures: true
==> default: Warning: /Stage[main]/Main/Apache::Vhost[ca.eclectic.vm]/File[25-ca.eclectic.vm.conf symlink]: Skipping because of failed dependencies
==> default: Notice: /Stage[main]/Apache::Service/Service[httpd]: Dependency Exec[concat_/etc/apache2/ports.conf] has failures: true
==> default: Notice: /Stage[main]/Apache::Service/Service[httpd]: Dependency Exec[concat_25-ca.eclectic.vm.conf] has failures: true
==> default: Notice: /Stage[main]/Apache::Service/Service[httpd]: Dependency Exec[concat_25-ssl-ca.eclectic.vm.conf] has failures: true
==> default: Warning: /Stage[main]/Apache::Service/Service[httpd]: Skipping because of failed dependencies
==> default: Notice: Finished catalog run in 18.24 seconds

我的人偶文件

# execute 'apt-get update'
exec { 'apt-update':
  command => 'apt-get update',
  path    => ["/usr/bin"],
}

# Install and configure apache2

class { 'apache':                # use the "apache" module
  default_vhost => false,        # don't use the default vhost
  default_mods => false,         # don't load default mods
  mpm_module => 'prefork',        # use the "prefork" mpm_module
  service_ensure => 'running',
}

include apache::mod::php
include apache::mod::rewrite

# Enable not define apache mods
# https://forge.puppetlabs.com/puppetlabs/apache#defined-type-apachemod
apache::mod { 'access_compat': }

# http eclectic version
apache::vhost { 'com.domain.vm':
  port        => '80',
  docadmin     => '/var/www/vhosts/domain.com/public_html',
  override    => ['all'],
  serveraliases => [
    'www.com.domain.vm',
  ],
}

# https eclectic version
apache::vhost { 'ssl-com.domain.vm':
  servername  =>  'com.domain.vm',
  port        => '443',
  docadmin     => '/var/www/vhosts/domain.com/public_html',
  override    => ['all'],
  ssl         => true,
  serveraliases => [
    'www.com.domain.vm',
  ],
}

# Setting up custom web eclectic direcotry
file { [
    "/var/www",
    "/var/www/vhosts",
    "/var/www/vhosts/domain.com"
  ]:
  ensure => "directory",
  owner  => "www-data",
  group  => "vagrant",
  mode   => 775,
}


# Add virtual host domain in /etc/hosts
host { 'com.domain.vm':
  ensure => present,
  ip => '127.0.0.1',
  host_aliases => 'www.com.domain.vm',
}


# install mysql-server package
package { 'mysql-server':
  require => Exec['apt-update'],        # require 'apt-update' before installing
  ensure => installed,
}

# ensure mysql service is running
service { 'mysql':
  ensure => running,
  require => Package['mysql-server'],
}


$packages = [
  'vim',
  'nano',
  'htop',
  'tree',
  'pv',
  'wget',
  'curl',
  'git',
  'php5',
  'php5-cli',
  'php5-gd',
  'php5-curl',
  'php5-mysql',
  'php5-mcrypt',
]

package { $packages:
  require => Exec['apt-update'],        # require 'apt-update' before installing
  ensure => installed,
}

exec { 'set-mysql-password':
  command => 'mysqladmin -u admin password "admin"',
  path    => ["/usr/bin"],
  logoutput => true,
  unless => 'mysqladmin -uadmin -padmin version',
  require => Service['mysql'],
}

package { 'php-pear':
  require => Exec['apt-update'],        # require 'apt-update' before installing
  ensure => installed,
  notify  => [
    Exec['pear-discover-channel-phing'],
    Exec['pear-install-Console_Table'],
    Exec['pear-install-Console_Color2'],
  ]
}


# http://puppet-php.readthedocs.org/en/latest/composer.html#installation
# Install to different destination
class { 'php::composer':
  destination => '/usr/bin/composer',
  notify  => Exec['composer-install-drush']
}

exec { "pear-discover-channel-phing":
  command => "pear channel-discover pear.phing.info",
  path    => ["/usr/bin"],
  logoutput => true,
  unless => 'pear channel-info pear.phing.info',
  require => Package['php-pear'],
  notify  => Exec['pear-install-phing'],
}

exec { "pear-install-phing":
  command => "pear install phing/phing",
  unless => "which phing",
  path    => ["/usr/bin"],
  logoutput => false,
  require => Exec['pear-discover-channel-phing'],
}

exec { "pear-install-Console_Table":
  command => "pear install Console_Table",
  unless => "pear info Console_Table",
  path    => ["/usr/bin"],
  logoutput => true,
}

exec { "pear-install-Console_Color2":
  command => "pear install Console_Color2-0.1.2",
  unless => "pear info Console_Color2-0.1.2",
  path    => ["/usr/bin"],
  logoutput => true,
}


####################################
# Install drush
exec { "git-clone-drush":
  command => "git clone https://github.com/drush-ops/drush.git /usr/local/src/drush",
  path    => ["/usr/bin"],
  unless  => 'test -d /usr/local/src/drush',
  notify  => Exec['git-checkout-drush']
}

exec { "git-checkout-drush":
  command => "git checkout 6.6.0",
  cwd     => "/usr/local/src/drush",
  path    => ["/usr/bin"],
  require => Exec['git-clone-drush'],
  notify  => File['/usr/bin/drush']
}

file { "/usr/bin/drush":
  ensure => 'link',
  target => '/usr/local/src/drush/drush',
  require => Exec['git-checkout-drush'],
  notify  => Exec['composer-install-drush']
}

exec { "composer-install-drush":
  environment => [ "COMPOSER_HOME=/usr/local/src/drush" ],
  command => "composer install",
  cwd     => "/usr/local/src/drush",
  path    => ["/usr/bin"],
  require => File['/usr/bin/drush']
}


# Copy ssh config vagrant file
file { '/home/vagrant/.ssh/config':
  ensure => present,
  mode   => 600,
  source => "puppet:///files/ssh/config/default-config",
}

您的问题可能与我最近几天在上面的问题相同。 就我而言,问题出在Windows git程序上。

在Windows下安装git时,它询问您是否要配置CRLF <-> LF转换-有3个选项:

  1. 默认情况下, 签出Windows风格,提交Unix风格的行尾 -这意味着在签出时将LF转换为CRLF,在提交时将CRLF转换为LF,
  2. 按原样签出,提交Unix样式的行编码 -签出时不进行转换,提交时不将CRLF转换为LF,
  3. 按原样签出,按原样提交 -完全不进行转换。

最初,我选择(1),因此git在签出以下模块之一icinga-vagrant \\ modules \\ concat ,特别是脚本文件icinga-vagrant \\ modules \\ concat \\ files \\ concatfragments.rb时,将LF转换为CRLF。 然后,该脚本将被复制(不进行转换)到目标Linux虚拟机,并且不会在该虚拟机上运行,​​因为/ usr / bin / env无法理解“ ruby​​ <CR>”的含义,这就是错误消息所具有的原因换行符:

... Could not evaluate: /usr/bin/env: ruby
: No such file or directory

解决方案是使用选项nr(2)重新安装git ,尽管无需重新安装就可以更改它-我有点懒。 现在,git按原样检查脚本,只有LF在行尾,因此在Linux上运行没有问题。

您是否在人偶中包含了stdlib模块? concat是其中的功能之一。 如果您通过librarian-puppet管理Puppetfile模块,可以向我展示Puppetfile吗?

似乎依赖是问题。 安装后应该可以解决您的问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM