Exemplo n.º 1
0
 def test_create_ssh_wrapper(self):
     self.assertEqual(check_data_writable(), [])
     filename = get_wrapper_filename()
     create_ssh_wrapper()
     with open(filename, 'r') as handle:
         data = handle.read()
         self.assertTrue(ssh_file('known_hosts') in data)
         self.assertTrue(ssh_file('id_rsa') in data)
         self.assertTrue(settings.DATA_DIR in data)
     self.assertTrue(os.access(filename, os.X_OK))
     # Second run should not touch the file
     timestamp = os.stat(filename).st_mtime
     create_ssh_wrapper()
     self.assertEqual(timestamp, os.stat(filename).st_mtime)
Exemplo n.º 2
0
 def __init__(self, path, branch=None, component=None, local=False):
     self.path = path
     if branch is None:
         self.branch = self.default_branch
     else:
         self.branch = branch
     self.component = component
     self.last_output = ''
     self.lock = FileLock(self.path.rstrip('/').rstrip('\\') + '.lock',
                          timeout=120)
     if not local:
         # Create ssh wrapper for possible use
         create_ssh_wrapper()
     if not self.is_valid():
         self.init()
Exemplo n.º 3
0
 def test_create_ssh_wrapper(self):
     check_data_writable()
     filename = get_wrapper_filename()
     create_ssh_wrapper()
     with open(filename, 'r') as handle:
         data = handle.read()
         self.assertTrue(ssh_file('known_hosts') in data)
         self.assertTrue(ssh_file('id_rsa') in data)
         self.assertTrue(settings.DATA_DIR in data)
     self.assertTrue(
         os.access(filename, os.X_OK)
     )
     # Second run should not touch the file
     timestamp = os.stat(filename).st_mtime
     create_ssh_wrapper()
     self.assertEqual(timestamp, os.stat(filename).st_mtime)
Exemplo n.º 4
0
 def __init__(self, path, branch=None, component=None, local=False):
     self.path = path
     if branch is None:
         self.branch = self.default_branch
     else:
         self.branch = branch
     self.component = component
     self.last_output = ''
     self.lock = FileLock(
         self.path.rstrip('/').rstrip('\\') + '.lock',
         timeout=120
     )
     if not local:
         # Create ssh wrapper for possible use
         create_ssh_wrapper()
     if not self.is_valid():
         self.init()
Exemplo n.º 5
0
 def clone(cls, source, target, branch=None):
     """Clone repository and return object for cloned repository."""
     create_ssh_wrapper()
     cls._clone(source, target, branch)
     return cls(target, branch)
Exemplo n.º 6
0
 def clone(cls, source, target, branch=None):
     """Clone repository and return object for cloned repository."""
     create_ssh_wrapper()
     cls._clone(source, target, branch)
     return cls(target, branch)