简体   繁体   中英

Puppet: vcsrepo with git , different request format between Ubuntu and CentOS

This is the code I have in my puppetmaster

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',
                }

And when I execute puppet agent with debug enabled as below

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

I could see that CentOS and Ubuntu puppet agents are sending request to Git in different ways and for Ubuntu I am able to pull the code from Git but for CentOS its failing with wrong revision number as below

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 Log

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 Log

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'

Dont know why CentOS looking it differently.

Thank you.

My internet connection broken while trying for my first checkout with git into /var/www/html directory and from 2nd attempt onward I have received that error.

I have removed complete /var/www/html with

rm -rf /var/www/html

and issued

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

and its worked fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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