gpt4 book ai didi

linux - Puppet:vcsrepo with git,Ubuntu 和 CentOS 之间的请求格式不同

转载 作者:太空宇宙 更新时间:2023-11-04 12:34:55 25 4
gpt4 key购买 nike

这是我的 puppet 大师中的代码

class mediawiki {

$phpmysql = $osfamily ? {
'redhat' => 'php-mysql',
'debian' => 'php5-mysql',
default => 'php-mysql',
}

package { $phpmysql:
ensure => 'present',
}

if $osfamily == 'redhat' {

package {'php-xml':
ensure => 'present',
}
}

class { '::apache':
docroot => '/var/www/html',
mpm_module => 'prefork',
subscribe => Package[$phpmysql],
}

class { '::apache::mod::php': }

vcsrepo {'/var/www/html':
ensure => 'present',
provider => 'git',
source => "https://github.com/wikimedia/mediawiki.git",
revision => 'REL1_23',
}

当我在启用调试的情况下执行 puppet 代理时,如下所示

puppet agent --debug --verbose --no-daemonize --onetime

我可以看到 CentOS 和 Ubuntu puppet 代理正在以不同的方式向 Git 发送请求,对于 Ubuntu,我能够从 Git 中提取代码,但对于 CentOS,它失败了,错误的修订号如下

Error: /Stage[main]/Mediawiki/Vcsrepo[/var/www/html]: Could not evaluate: Execution of '/usr/bin/git rev-parse HEAD' returned 128: fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions
HEAD

CentOS 调试日志

Debug: /Stage[main]/Linux/File[/info.txt]: The container Class[Linux] will propagate my refresh event
Debug: /Stage[main]/Mediawiki/File[/var/www/html/index.html]: Nothing to manage: no ensure and the resource doesn't exist
Debug: Executing '/usr/bin/git config --get remote.origin.url'
Debug: Executing '/usr/bin/git remote'
Debug: Executing '/usr/bin/git config --get remote.origin.url'
Debug: Executing '/usr/bin/git fetch origin'
Debug: Executing '/usr/bin/git fetch --tags origin'
Debug: Executing '/usr/bin/git rev-parse HEAD'
Error: /Stage[main]/Mediawiki/Vcsrepo[/var/www/html]: Could not evaluate: Execution of '/usr/bin/git rev-parse HEAD' returned 128: fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions
HEAD

Ubuntu 调试日志

Debug: /Stage[main]/Mediawiki/File[/var/www/html/index.html]: Nothing to manage: no ensure and the resource doesn't exist
Debug: Executing '/usr/bin/git config --get remote.origin.url'
Debug: Executing '/usr/bin/git remote'
Debug: Executing '/usr/bin/git config --get remote.origin.url'
Debug: Executing '/usr/bin/git fetch origin'
Debug: Executing '/usr/bin/git fetch --tags origin'
Debug: Executing '/usr/bin/git rev-parse HEAD'
Debug: Executing '/usr/bin/git tag -l'
Debug: Executing '/usr/bin/git branch -a'
Debug: Executing '/usr/bin/git rev-parse REL1_23'

不知道为什么 CentOS 看起来不一样。

谢谢。

最佳答案

第一次尝试使用 git checkout 到/var/www/html 目录时,我的互联网连接中断了,从第二次尝试开始,我收到了该错误。

我已经删除了完整的/var/www/html

rm -rf /var/www/html

并发布

puppet agent --verbose --no-daemonize --onetime

它运行良好。

关于linux - Puppet:vcsrepo with git,Ubuntu 和 CentOS 之间的请求格式不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42220030/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com