Пример #1
0
  def test_process_list(self):
    hash_list = [
      'software_release/buildout.cfg',
    ]
    expected_process_names = [
      'bootstrap-monitor',
      'mariadb',
      'mariadb_update',
      'apache-php-{hash}-on-watch',
      'certificate_authority-{hash}-on-watch',
      'crond-{hash}-on-watch',
      'monitor-httpd-{hash}-on-watch',
      'monitor-httpd-graceful',
      'nextcloud-install',
      'nextcloud-news-updater',
      'redis-on-watch',
    ]

    with self.slap.instance_supervisor_rpc as supervisor:
      process_name_list = [process['name']
                     for process in supervisor.getAllProcessInfo()]

    hash_file_list = [os.path.join(self.computer_partition_root_path, path)
                      for path in hash_list]

    for name in expected_process_names:
      h = generateHashFromFiles(hash_file_list)
      expected_process_name = name.format(hash=h)

      self.assertIn(expected_process_name, process_name_list)
Пример #2
0
    def test_hashes(self):
        hash_files = [
            'software_release/buildout.cfg',
        ]
        expected_process_names = [
            'slaprunner-supervisord-{hash}-on-watch',
            'runner-sshd-{hash}-on-watch',
            'slaprunner-httpd-{hash}-on-watch',
            'gunicorn-{hash}-on-watch',
            'nginx-frontend-{hash}-on-watch',
            'certificate_authority-{hash}-on-watch',
            'shellinaboxd-{hash}-on-watch',
            'supervisord-{hash}-on-watch',
        ]

        with self.slap.instance_supervisor_rpc as supervisor:
            process_names = [
                process['name'] for process in supervisor.getAllProcessInfo()
            ]

        hash_files = [
            os.path.join(self.computer_partition_root_path, path)
            for path in hash_files
        ]

        for name in expected_process_names:
            h = generateHashFromFiles(hash_files)
            expected_process_name = name.format(hash=h)

            self.assertIn(expected_process_name, process_names)
Пример #3
0
    def test_hashes(self):
        hash_files = [
            'software_release/buildout.cfg',
        ]
        expected_process_names = [
            '6tunnel-10022-{hash}-on-watch',
            '6tunnel-10080-{hash}-on-watch',
            '6tunnel-10443-{hash}-on-watch',
            'certificate_authority-{hash}-on-watch',
            'crond-{hash}-on-watch',
            'kvm-{hash}-on-watch',
            'websockify-{hash}-on-watch',
        ]

        with self.slap.instance_supervisor_rpc as supervisor:
            process_names = [
                process['name'] for process in supervisor.getAllProcessInfo()
            ]

        hash_files = [
            os.path.join(self.computer_partition_root_path, path)
            for path in hash_files
        ]

        for name in expected_process_names:
            h = generateHashFromFiles(hash_files)
            expected_process_name = name.format(hash=h)

            self.assertIn(expected_process_name, process_names)
Пример #4
0
 def __init__(self, buildout, name, options):
     self.buildout = buildout
     self.options = options
     hash_files = options.get('hash-files')
     if hash_files:
       self.hash_files = hash_files.split()
       prefix = os.path.realpath(buildout['buildout']['directory']) + os.sep
       self._existing = [x for x in self.hash_files
           if os.path.exists(x) and not os.path.realpath(x).startswith(prefix)]
     else:
       self.hash_files = []
     hash_files = options.get('hash-existing-files')
     if hash_files:
       hash_files = hash_files.split()
       options['__hash_files__'] = generateHashFromFiles(hash_files)
       self.hash_files += hash_files
Пример #5
0
    def test_hashes(self):
        hash_files = [
            'var/tomcat/conf/server.xml', 'software_release/buildout.cfg'
        ]
        expected_process_names = [
            'tomcat-instance-{hash}-on-watch',
        ]

        with self.slap.instance_supervisor_rpc as supervisor:
            process_names = [
                process['name'] for process in supervisor.getAllProcessInfo()
            ]

        hash_files = [
            os.path.join(self.computer_partition_root_path, path)
            for path in hash_files
        ]

        for name in expected_process_names:
            h = generateHashFromFiles(hash_files)
            expected_process_name = name.format(hash=h)

            self.assertIn(expected_process_name, process_names)
Пример #6
0
 def getWrapperPath(self):
     wrapper_path = self.options['wrapper-path']
     if self.hash_files:
       wrapper_path += '-' + generateHashFromFiles(self.hash_files)
     return wrapper_path