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, basename
 | 
			
		||||
from os.path import join
 | 
			
		||||
 | 
			
		||||
directories = {
 | 
			
		||||
    '/etc/apt/sources.list.d': {
 | 
			
		||||
| 
						 | 
				
			
			@ -36,17 +35,15 @@ for name, content in node.metadata.get('apt/sources').items():
 | 
			
		|||
            'action:apt_update',
 | 
			
		||||
        },
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    matches = glob(join(repo.path, 'data', 'apt', 'keys', f'{name}.*'))
 | 
			
		||||
    if matches:
 | 
			
		||||
        assert len(matches) == 1
 | 
			
		||||
        files[f'/etc/apt/trusted.gpg.d/{basename(matches[0])}'] = {
 | 
			
		||||
            'source': matches[0],
 | 
			
		||||
            'content_type': 'binary',
 | 
			
		||||
            'triggers': {
 | 
			
		||||
                'action:apt_update',
 | 
			
		||||
            },
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
for key in node.metadata.get('apt/keys'):
 | 
			
		||||
    files[f'/etc/apt/trusted.gpg.d/{key}'] = {
 | 
			
		||||
        'source': join(repo.path, 'data', 'apt', 'keys', key),
 | 
			
		||||
        'content_type': 'binary',
 | 
			
		||||
        'triggers': {
 | 
			
		||||
            'action:apt_update',
 | 
			
		||||
        },
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
for package, options in node.metadata.get('apt/packages', {}).items():
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,32 @@
 | 
			
		|||
from glob import glob
 | 
			
		||||
from os.path import join, basename
 | 
			
		||||
 | 
			
		||||
defaults = {
 | 
			
		||||
    'apt': {
 | 
			
		||||
        'packages': {},
 | 
			
		||||
        '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': {},
 | 
			
		||||
            'ca-certificates': {},
 | 
			
		||||
            'gnupg': {},
 | 
			
		||||
            'google-cloud-sdk': {},
 | 
			
		||||
        },
 | 
			
		||||
        'sources': {
 | 
			
		||||
            'gcloud': 'deb https://packages.cloud.google.com/apt cloud-sdk main',
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue