wip
This commit is contained in:
		
							parent
							
								
									7570b9135b
								
							
						
					
					
						commit
						ab14522e97
					
				
					 3 changed files with 37 additions and 13 deletions
				
			
		| 
						 | 
					@ -1,5 +1,4 @@
 | 
				
			||||||
from glob import glob
 | 
					from os.path import join
 | 
				
			||||||
from os.path import join, basename
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
directories = {
 | 
					directories = {
 | 
				
			||||||
    '/etc/apt/sources.list.d': {
 | 
					    '/etc/apt/sources.list.d': {
 | 
				
			||||||
| 
						 | 
					@ -37,11 +36,9 @@ for name, content in node.metadata.get('apt/sources').items():
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    matches = glob(join(repo.path, 'data', 'apt', 'keys', f'{name}.*'))
 | 
					for key in node.metadata.get('apt/keys'):
 | 
				
			||||||
    if matches:
 | 
					    files[f'/etc/apt/trusted.gpg.d/{key}'] = {
 | 
				
			||||||
        assert len(matches) == 1
 | 
					        'source': join(repo.path, 'data', 'apt', 'keys', key),
 | 
				
			||||||
        files[f'/etc/apt/trusted.gpg.d/{basename(matches[0])}'] = {
 | 
					 | 
				
			||||||
            'source': matches[0],
 | 
					 | 
				
			||||||
        'content_type': 'binary',
 | 
					        'content_type': 'binary',
 | 
				
			||||||
        'triggers': {
 | 
					        'triggers': {
 | 
				
			||||||
            'action:apt_update',
 | 
					            'action:apt_update',
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,32 @@
 | 
				
			||||||
 | 
					from glob import glob
 | 
				
			||||||
 | 
					from os.path import join, basename
 | 
				
			||||||
 | 
					
 | 
				
			||||||
defaults = {
 | 
					defaults = {
 | 
				
			||||||
    'apt': {
 | 
					    'apt': {
 | 
				
			||||||
        'packages': {},
 | 
					        'packages': {},
 | 
				
			||||||
        'sources': {},
 | 
					        'sources': {},
 | 
				
			||||||
 | 
					        'keys': [],
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@metadata_reactor.provides(
 | 
				
			||||||
 | 
					    'apt/keys',
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					def keys(metadata):
 | 
				
			||||||
 | 
					    keys = []
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    for name in node.metadata.get('apt/sources'):
 | 
				
			||||||
 | 
					        matches = glob(join(repo.path, 'data', 'apt', 'keys', f'{name}.*'))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if matches:
 | 
				
			||||||
 | 
					            assert len(matches) == 1
 | 
				
			||||||
 | 
					            keys.append(basename(matches[0]))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return {
 | 
				
			||||||
 | 
					        'apt': {
 | 
				
			||||||
 | 
					            'keys': keys,
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,6 +4,7 @@ defaults = {
 | 
				
			||||||
            'apt-transport-https': {},
 | 
					            'apt-transport-https': {},
 | 
				
			||||||
            'ca-certificates': {},
 | 
					            'ca-certificates': {},
 | 
				
			||||||
            'gnupg': {},
 | 
					            'gnupg': {},
 | 
				
			||||||
 | 
					            'google-cloud-sdk': {},
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        'sources': {
 | 
					        'sources': {
 | 
				
			||||||
            'gcloud': 'deb https://packages.cloud.google.com/apt cloud-sdk main',
 | 
					            'gcloud': 'deb https://packages.cloud.google.com/apt cloud-sdk main',
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue