Esempio n. 1
0
  def install(self):
    common.logit("\nVerifying VDT client installation")
    common.logit("... validating vdt_location: %s" % self.vdt_location())
    common.check_for_value("vdt_location",self.vdt_location())
    if self.client_exists():
      common.logit("... installed in: %s" % self.vdt_location())
      return
    common.ask_continue("""... VDT client not found in: %s
This script is checking for the presence of 2 scripts:
  setup.sh and voms-proxy-init 
Is it OK to install it in this location""" % self.vdt_location())
    packages = ""
    for package in self.vdt_packages:
      packages = packages + "%s:%s " % (self.vdt_cache(),package)
    for package in self.osg_packages:
      packages = packages + "%s:%s " % (self.osg_cache(),package)
    
    common.logit("\n======== VDT Client install starting ==========")
    common.logit("The packages that will be installed are:")
    for package in packages.split(" "):
      common.logit("  %s" % package)
    self.install_vdt_package(packages)
    if self.client_exists():
      common.logit("... VDT client installation looks good")
    common.logit("======== VDT Client install complete ==========\n")
    common.ask_continue("Continue installation")
Esempio n. 2
0
 def install_vdt_package(self,packages):
   """ Installs specified VDT packages. """
   self.install_pacman()
   common.logit("... validating vdt_location: %s" % self.vdt_location())
   common.check_for_value("vdt_location",self.vdt_location())
   common.make_directory(self.vdt_location(),self.username(),0755)
   #-- install vdt packages ---
   self.messagesDict["packages"] = packages
   common.logit("... installing VDT packages")
   common.run_script("export VDTSETUP_AGREE_TO_LICENSES=y; . %(pacman_location)s/setup.sh && cd %(vdt_location)s && pacman -trust-all-caches -get %(packages)s" % self.messagesDict)
   #--- vdt-post-install --
   common.run_script(". %(vdt_location)s/setup.sh && vdt-post-install" % self.messagesDict)
Esempio n. 3
0
    def install_pacman(self):
        """ Installs pacman if not present. """
        common.logit("... validating pacman_location: %s" % self.pacman_location())
        common.check_for_value("pacman_location", self.pacman_location())
        if self.pacman_is_installed():
            os.system("sleep 2")
            return  # -- no need to install pacman--
        common.ask_continue(
            """
Pacman is required and does not appear to be installed in:
  %(pacman_location)s
... continue with pacman installation"""
            % self.messagesDict
        )
        common.logit(
            """
======== pacman install starting ========== """
        )
        common.check_for_value("pacman_location", self.pacman_location())
        if os.path.exists(self.pacman_location()):
            common.logerr(
                """The pacman_location for the pacman installation already exists 
and should not.  This script was looking for a setup.sh in that directory 
and it did not exist.  If a valid pacman distribution, it may be corrupt or the 
pacman_location  is incorrect.  Please verify."""
            )
        common.logit("... validating pacman_url: %s" % self.pacman_url())
        common.check_for_value("pacman_url", self.pacman_url())
        if not common.wget_is_valid(self.pacman_urlfile()):
            common.logerr(
                """A pacman tarball of this name does not exist at:
    %(pacman_urlfile)s
... please verify."""
                % self.messagesDict
            )
        os.system("sleep 2")
        common.make_directory(self.pacman_parent(), self.username(), 0755)
        common.run_script(
            "cd %(pacman_parent)s && wget %(pacman_urlfile)s && tar --no-same-owner -xzf %(pacman_tarball)s && rm -f  %(pacman_tarball)s"
            % self.messagesDict
        )
        if not self.pacman_is_installed():
            common.logerr("Pacman install failed. No setup.sh file exists in: %(pacman_location)s" % self.messagesDict)
        common.logit(
            """... pacman requires the setup script to be sourced to initialize 
    some variables in it for subsequent use."""
        )
        common.run_script("cd %(pacman_location)s && source setup.sh" % self.messagesDict)
        common.logit("\nPacman successfully installed: %(pacman_location)s" % self.messagesDict)
        common.logit("======== pacman install complete ==========\n")
        os.system("sleep 2")
Esempio n. 4
0
  def install(self):
    """ Installs the VDT CA package if X509 CA certiificates do not already
        exist. 
    """
    common.logit("\nVerifying CA Certificates installation")
    common.logit("... validating %(option)s: %(dir)s" % \
                       { "option" : self.option,
                         "dir"    : self.x509_cert_dir()})
    if self.certificates_exist():
      common.logit("... CA Certificates exist with *.0 and *.r0 files")
      return
    common.ask_continue("""There were no certificate (*.0) or CRL (*.r0) files found.
These can be installed from the VDT using pacman.  
If you want to do this, these options must be set:
  vdt_location  pacman_url  pacman_location
Additionally your %(option)s should specify this location: 
   vdt_location/globus/TRUSTED_CA 
Is it OK to proceed with the installation of certificates with these settings.
If not, stop and correct the %(option)s""" % { "option"       : self.option, })

    common.logit("... verifying vdt_location: %s" % self.vdt_location())
    common.check_for_value("vdt_location",self.vdt_location())
    common.logit("... verifying pacman_location: %s" % self.pacman_location())
    common.check_for_value("pacman_location",self.pacman_location())
    common.logit("... verifying pacman_url: %s" % self.pacman_url())
    common.check_for_value("pacman_url",self.pacman_url())

    expected_x509_cert_dir = "%s/globus/TRUSTED_CA" % self.vdt_location()
    if self.x509_cert_dir() != expected_x509_cert_dir:
      common.logerr("""Sorry but the %(option)s must be set to %(expected)s""" % \
                       { "option"  : self.option,
                         "expected" : expected_x509_cert_dir,} )

    if common.not_writeable(os.path.dirname(self.vdt_location())):
      common.logerr("""You do not have permissions to create the vdt_location 
option specified: %(dir)s""" %  { "dir"    : self.vdt_location(),})
    common.logit(""" CA certificates install starting. The packages that will be installed are:
   %(package)s""" % { "package" : self.package,})
    self.install_vdt_package(self.package)
    common.logit("... retrieving certificates") 
    common.run_script(". %(vdt_location)s/setup.sh; %(vdt_location)s/vdt/bin/vdt-ca-manage setupca --location %(dir)s --url osg" % \
       { "vdt_location" : self.vdt_location(),
         "dir"          : os.path.dirname(self.x509_cert_dir())})
    self.create_crontab()
    if self.certificates_exist():
      common.logit("... certificate installation looks good")
    common.logit("\nCA certificates install complete\n")
    common.ask_continue("Continue installation")
Esempio n. 5
0
 def x509_cert_dir(self):
   """ Returns the full path the X509 certificates directory.  """
   cert_dir = self.option_value(self.ini_section,self.option)
   common.check_for_value("x509_cert_dir",cert_dir)
   return cert_dir
Esempio n. 6
0
 def pacman_is_installed(self):
   common.check_for_value("pacman_location",self.pacman_location())
   if os.path.isfile("%s/setup.sh" % self.pacman_location()):
     return True
   return False