コード例 #1
0
 def test_copy_keys(self):
     task_config = {
         'id': 'copy_keys',
         'type': 'copy_files',
         'role': '*',
         'parameters': {
             'files': [{
                 'src': '/var/www/nailgun/keys/{CLUSTER_ID}/nova.key',
                 'dst': '/var/lib/astute/nova.key'
             }],
             'permissions':
             '0600',
             'dir_permissions':
             '0700'
         }
     }
     task = tasks_serializer.CopyKeys(task_config, self.cluster, self.nodes)
     serialized = next(task.serialize())
     self.assertEqual(serialized['type'], 'copy_files')
     files = []
     files.append({
         'src':
         '/var/www/nailgun/keys/{CLUSTER_ID}/nova.key'.format(
             CLUSTER_ID=self.cluster.id),
         'dst':
         '/var/lib/astute/nova.key'
     })
     self.assertItemsEqual(files, serialized['parameters']['files'])
コード例 #2
0
 def test_copy_keys_no_nodes(self):
     task_config = {
         'id': 'copy_keys',
         'type': 'copy_files',
         'role': '*',
         'parameters': {
             'files': [{
                 'src': '/var/www/nailgun/keys/{CLUSTER_ID}/nova.key',
                 'dst': '/var/lib/astute/nova.key'}],
             'permissions': '0600',
             'dir_permissions': '0700'}}
     task = tasks_serializer.CopyKeys(
         task_config, self.cluster, [])
     with self.assertRaises(StopIteration):
         next(task.serialize())