Changeset 1714 in ProjectBuilder


Ignore:
Timestamp:
Mar 10, 2013, 6:17:47 PM (11 years ago)
Author:
Bruno Cornec
Message:
  • remove param vmntpcmd and use oscmdntp instead placed in pb.conf
  • Improve ntp handling for setupvm by adding a call to date when ntpdate is failing
  • Update appropriate docs
  • Fix pb_get_sudocmds which was using @_ directly which was impacting parameters in the calling function, and removed e.g. the ntp server name from the cmd line !
  • TODO: if a ntpd server is running, avoid doing all ntp/date stuff
Location:
devel
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • devel/pb-modules/etc/pb.conf

    r1702 r1714  
    331331#
    332332rbsmindep fedora-16 = ConsoleKit-libs,audit-libs,basesystem,bash,bzip2-libs,c-ares,chkconfig,coreutils,cpio,cracklib,cracklib-dicts,crontabs,cyrus-sasl-lib,db4,dbus,dbus-libs,device-mapper,device-mapper-libs,dhclient,e2fsprogs,e2fsprogs-libs,elfutils-libelf,expat,fedora-release,fedora-release-notes,file,file-libs,filesystem,findutils,gamin,gawk,gdbm,glib2,glibc,glibc-common,gnupg2,gpgme,grep,info,initscripts,iproute,iputils,keyutils-libs,krb5-libs,libacl,libattr,libcap,libcom_err,libcurl,libgcc,libgcrypt,libgpg-error,libidn,libselinux,libsepol,libssh2,libstdc++,libusb,libxml2,linux-atm-libs,logrotate,lua,mingetty,module-init-tools,ncurses,ncurses-base,ncurses-libs,net-tools,nspr,nss,nss-softokn,nss-softokn-freebl,nss-util,openldap,openssl,pam,passwd,pcre,pinentry,popt,procps,psmisc,pth,pygpgme,python,python-iniparse,python-libs,python-pycurl,python-urlgrabber,readline,rpm,rpm-libs,rpm-python,rsyslog,sed,setup,shadow-utils,sqlite,sysvinit-tools,tzdata,udev,vim-minimal,xz-libs,yum,yum-metadata-parser,zlib
     333#
     334rbsmindep fedora-17 = ConsoleKit-libs,audit-libs,basesystem,bash,bzip2-libs,c-ares,chkconfig,coreutils,cpio,cracklib,cracklib-dicts,crontabs,cyrus-sasl-lib,db4,dbus,dbus-libs,device-mapper,device-mapper-libs,dhclient,e2fsprogs,e2fsprogs-libs,elfutils-libelf,expat,fedora-release,fedora-release-notes,file,file-libs,filesystem,findutils,gamin,gawk,gdbm,glib2,glibc,glibc-common,gnupg2,gpgme,grep,info,initscripts,iproute,iputils,keyutils-libs,krb5-libs,libacl,libattr,libcap,libcom_err,libcurl,libgcc,libgcrypt,libgpg-error,libidn,libselinux,libsepol,libssh2,libstdc++,libusb,libxml2,linux-atm-libs,logrotate,lua,mingetty,module-init-tools,ncurses,ncurses-base,ncurses-libs,net-tools,nspr,nss,nss-softokn,nss-softokn-freebl,nss-util,openldap,openssl,pam,passwd,pcre,pinentry,popt,procps,psmisc,pth,pygpgme,python,python-iniparse,python-libs,python-pycurl,python-urlgrabber,readline,rpm,rpm-libs,rpm-python,rsyslog,sed,setup,shadow-utils,sqlite,sysvinit-tools,tzdata,udev,vim-minimal,xz-libs,yum,yum-metadata-parser,zlib
    333335#
    334336rbsmindep centos-4 = MAKEDEV,SysVinit,audit-libs,basesystem,bash,beecrypt,bzip2-libs,centos-release,coreutils,cracklib,cracklib-dicts,db4,device-mapper,e2fsprogs,elfutils-libelf,ethtool,expat,filesystem,findutils,gawk,gdbm,glib2,glibc,glibc-common,grep,info,initscripts,iproute,iputils,krb5-libs,libacl,libattr,libcap,libgcc,libidn,libselinux,libsepol,libstdc++,libtermcap,libxml2,libxml2-python,mingetty,mktemp,module-init-tools,ncurses,neon,net-tools,openssl,pam,pcre,popt,procps,psmisc,python,python-elementtree,python-sqlite,python-urlgrabber,readline,rpm,rpm-libs,rpm-python,sed,setup,shadow-utils,sqlite,sysklogd,termcap,tzdata,udev,util-linux,yum,yum-metadata-parser,zlib
     
    647649ospathcmd-halt default = /sbin/halt
    648650
     651oscmdntp default = /usr/sbin/ntpdate
     652#oscmdntp opensuse-11.0-i386 = sntp -P no -r
     653#oscmdntp opensuse-11.0-x86_64 = sntp -P no -r
     654
    649655# Do you want pb to create a dedicated SSH key pair to dialog with VM|RM
    650656# or do you prefer to use an existing SSH Agent instead and existing keys
     
    673679# Number of process in // for pb
    674680#pbparallel pb = 2
    675 #
     681
     682
     683# Distros may have different modes for /etc/sudoers
     684ossudoersmode default = 440
     685ossudoersmode suse-10.2 = 640
     686
    676687
    677688#
  • devel/pb-modules/etc/pb.conf.pod

    r1702 r1714  
    725725 Nature: Optional
    726726 Key: project (as defined in the -p option or PBPROJ environment variable)
    727  Value: NTP server to contact for time accuracy with B<rmntpcmd> before building.
     727 Value: NTP server to contact for time accuracy with B<ospathcmd-ntpdate> before building.
    728728 Conffile: rm
    729729 Example: rmntp default = 1.pool.ntp.org
    730 
    731 =item B<rmntpcmd>
    732 
    733  Nature: Mandatory
    734  Key: OS (could be from the most generic up to the most specific from ostype, osfamily, os, os-ver, os-ver-arch).
    735  Value: NTP command to use to perform time synchronization with the B<rmntp> server. Use full path name, as this command will be used in the sudoers file to allow its launch by root.
    736  Conffile: rm
    737  Example: rmntpcmd default = /usr/sbin/ntpdate,rmntpcmd opensuse-10.1-i386 = /usr/sbin/sntp -P no -r
    738730
    739731=item B<rmpath>
     
    841833 Nature: Optional
    842834 Key: project (as defined in the -p option or PBPROJ environment variable)
    843  Value: NTP server to contact for time accuracy with B<ventpcmd> before building.
     835 Value: NTP server to contact for time accuracy with B<ospathcmd-ntpdate> before building.
    844836 Conffile: ve
    845837 Example: ventp default = 1.pool.ntp.org
    846 
    847 =item B<ventpcmd>
    848 
    849  Nature: Mandatory
    850  Key: project (as defined in the -p option or PBPROJ environment variable)
    851  Value: NTP command to use to perform time synchronization with the B<ventp> server. Use full path name, as this command will be used in the sudoers file to allow its launch by root.
    852  Conffile: ve
    853  Example: ventpcmd default = /usr/sbin/ntpdate
    854838
    855839=item B<vepath>
     
    953937 Nature: Optional
    954938 Key: project (as defined in the -p option or PBPROJ environment variable)
    955  Value: NTP server to contact for time accuracy with B<vmntpcmd> before building.
     939 Value: NTP server to contact for time accuracy with B<ospathcmd-ntpdate> before building.
    956940 Conffile: vm
    957941 Example: vmntp default = 1.pool.ntp.org
    958 
    959 =item B<vmntpcmd>
    960 
    961  Nature: Mandatory
    962  Key: OS (could be from the most generic up to the most specific from ostype, osfamily, os, os-ver, os-ver-arch).
    963  Value: NTP command to use to perform time synchronization with the B<vmntp> server. Use full path name, as this command will be used in the sudoers file to allow its launch by root.
    964  Conffile: vm
    965  Example: vmntpcmd default = /usr/sbin/ntpdate,vmntpcmd opensuse-11.0-i386 = /usr/sbin/sntp -P no -r
    966942
    967943=item B<vmopt>
  • devel/pb/bin/pb

    r1712 r1714  
    19151915    my $tmout = undef;
    19161916    my $path = undef;
     1917
    19171918    if ($cmt =~ /^VM/) {
    19181919        $login = "vmlogin";
     
    27462747my $nontp = shift || 0;
    27472748
     2749pb_log(1,"Entering pb_date2v\n");
    27482750# VE gets time from parent OS.
    27492751return "/bin/true" if ($vtype) =~ /^ve/o;
    27502752
    27512753my ($ntp) = pb_conf_get_if($vtype."ntp");
    2752 my $vntp = $ntp->{$ENV{'PBPROJ'}} if (defined $ntp);
     2754my $vntp = undef;
    27532755my $ntpline = undef;
     2756$vntp = $ntp->{$ENV{'PBPROJ'}} if (defined $ntp);
    27542757
    27552758if ((defined $vntp) && ($vntp !~ /^\s*$/)) {
     2759    pb_log(2,"ntp server is $vntp\n");
    27562760    # ntp command depends on pbos
    2757     my $vntpcmd = pb_distro_get_param($pbos,pb_conf_get($vtype."ntpcmd"));
     2761    my $vntpcmd = pb_distro_get_param($pbos,pb_conf_get("oscmdntp"));
    27582762    $ntpline = "sudo $vntpcmd $vntp";
    27592763}
     
    27652769my $dateline = "sudo /bin/date $upddate";
    27662770if ((defined $ntpline) && ($nontp == 0)) {
     2771    pb_log(1,"pb_date2v returns $ntpline\n");
    27672772    return($ntpline);
    27682773} else {
     2774    pb_log(1,"pb_date2v returns $dateline\n");
    27692775    return($dateline);
    27702776}
     
    34083414print PBOUT "$pbac->{$ENV{'PBPROJ'}}   ALL=(ALL) NOPASSWD:ALL\n";
    34093415EOF
    3410 }
     3416    }
    34113417    print SCRIPT << 'EOF';
    34123418close(PBOUT);
     
    34193425        # Sync date
    34203426        # do it after sudoers is setup
    3421         print SCRIPT "pb_system(\"$ntpline\",\"Updating time with $ntpline\",\"mayfail\");\n";
     3427        print SCRIPT "my \$res = pb_system(\"$ntpline\",\"Updating time with $ntpline\",\"mayfailverbose\");\n";
     3428        print SCRIPT "if (\$res != 0) {\n";
     3429        # try again with another method
     3430        $ntpline = pb_date2v($vtype,$pbos,1);
     3431        print SCRIPT "  pb_system(\"$ntpline\",\"Updating time with $ntpline\",\"mayfailverbose\");\n";
     3432        print SCRIPT "}\n";
    34223433    }
    34233434
     
    43824393       
    43834394my $pbos = shift;
     4395my @cmds = @_;
    43844396my %sudocmds;
    43854397
    4386 pb_log(2,"pb_get_sudocmds entering with lines:".Dumper(@_)."\n");
    4387 foreach my $c (split(/;/,$pbos->{'update'}),split(/;/,$pbos->{'install'}),@_) {
     4398pb_log(2,"pb_get_sudocmds entering with lines:".Dumper(@cmds)."\n");
     4399foreach my $c (split(/;/,$pbos->{'update'}),split(/;/,$pbos->{'install'}),@cmds) {
    43884400    pb_log(2,"pb_get_sudocmds analyses $c\n");
    43894401    next if ($c !~ /^\s*sudo/);
  • devel/rpmbootstrap/etc/.pbrc

    r1652 r1714  
    1919# Hash for VE stuff on vmtype
    2020ventp default = 1.pool.ntp.org
    21 ventpcmd default = /usr/sbin/ntpdate
    2221
    2322# We suppose we can commmunicate with the VE through schroot
Note: See TracChangeset for help on using the changeset viewer.