Пример #1
0
  def _deploy(self, code_dirs):
    compressed_file_name = 'tmp.tar.gz'
    exclude_dir = '.git'

    for code_dir in code_dirs:
      if os.path.exists(code_dir):
        upholstery.local(self.tar + ' ' + self.tar_compress_flags + ' ' + compressed_file_name + \
                         ' ' + code_dir + ' --exclude "' + exclude_dir + '"')
        upholstery.put(compressed_file_name, compressed_file_name)
        upholstery.local(self.rm + compressed_file_name)

        # Decompress and Clean up
        upholstery.run(self.tar + ' ' + self.tar_decompress_flags + ' ' + compressed_file_name)
        upholstery.run(self.rm + compressed_file_name)

        if self.datetime:
          indivo_servers_location = '/web/' + code_dir + 's/' + \
                                    code_dir + '-' + \
                                    str(self.datetime.year) + '_' + \
                                    str(self.datetime.month) + '_' + \
                                    str(self.datetime.day)
        else:
          indivo_server_location = '/web/'

        # SZ: Remove this in the future
        upholstery.sudo(self.mv + code_dir + ' ' + indivo_servers_location)

    return True
Пример #2
0
 def deploy_virtual_host(self):
   # SZ: randomize
   filename_virtual_host = 'virtual_host'
   virtual_host_path = '/etc/apache2/sites-enabled/000-default'
   if self.create_file(filename_virtual_host, virtual_host):
     upholstery.put(filename_virtual_host, filename_virtual_host)
     upholstery.local(self.rm + filename_virtual_host)
     upholstery.sudo(self.mv + filename_virtual_host + ' ' + virtual_host_path)
Пример #3
0
  def deploy_ports_conf(self):
    ports_conf= """
    NameVirtualHost *:80
    Listen 80
    Listen 8000
    """

    ports_path = '/etc/apache2/ports.conf'
    filename_ports_conf = 'ports_conf'
    if self.create_file(filename_ports_conf, ports_conf):
      upholstery.put(filename_ports_conf, filename_ports_conf)
      upholstery.local(self.rm + filename_ports_conf)
      upholstery.sudo(self.mv + filename_ports_conf + ' ' + ports_path)