Merge branch 'develop' into dist/risotto/risotto-2.8.0/develop
This commit is contained in:
commit
b1eb050c8d
@ -33,7 +33,7 @@ def setting_pki_openssh_client(dico, config):
|
|||||||
add = new - current
|
add = new - current
|
||||||
modify = [key for key in new if key in current and current_data[key] != new_data[key]]
|
modify = [key for key in new if key in current and current_data[key] != new_data[key]]
|
||||||
if add or modify:
|
if add or modify:
|
||||||
print(f'\n\nModifications suggérées de la section "Host {hostname}"du fichier "{config_file}" :')
|
print(f'\n\nModifications suggérées de la section "Host {hostname}" du fichier "{config_file}" :')
|
||||||
for line in add:
|
for line in add:
|
||||||
value = new_data[line]
|
value = new_data[line]
|
||||||
if isinstance(value, list):
|
if isinstance(value, list):
|
||||||
@ -43,17 +43,21 @@ def setting_pki_openssh_client(dico, config):
|
|||||||
value = new_data[line]
|
value = new_data[line]
|
||||||
if isinstance(value, list):
|
if isinstance(value, list):
|
||||||
value = ','.join(value)
|
value = ','.join(value)
|
||||||
print(f' - modifier "{line} {value}"')
|
print(f' - modifier "{line} {current_data[line]}" en "{line} {value}"')
|
||||||
print('\n')
|
print('\n')
|
||||||
else:
|
else:
|
||||||
print(f'\n\nIl faudrait créer le fichier "{config_file}" :')
|
if not isdir(config_dir):
|
||||||
print(f'Host {hostname}')
|
makedirs(config_dir, 0o700)
|
||||||
|
fh = os_open(config_file, O_WRONLY | O_CREAT, 0o400)
|
||||||
|
truncate(fh, 0)
|
||||||
|
write(fh, f'Host {hostname}\n'.encode())
|
||||||
for key, value in new_data.items():
|
for key, value in new_data.items():
|
||||||
if key == 'hostname':
|
if key == 'hostname':
|
||||||
continue
|
continue
|
||||||
print(f' {key} {value}')
|
if isinstance(value, list):
|
||||||
if not isdir(config_dir):
|
value = ','.join(value)
|
||||||
makedirs(config_dir, 0o700)
|
write(fh, f' {key} {value}\n'.encode())
|
||||||
|
close(fh)
|
||||||
fh = os_open(f'{identityfile}.pub', O_WRONLY | O_CREAT, 0o400)
|
fh = os_open(f'{identityfile}.pub', O_WRONLY | O_CREAT, 0o400)
|
||||||
truncate(fh, 0)
|
truncate(fh, 0)
|
||||||
write(fh, dico['certificate'].encode())
|
write(fh, dico['certificate'].encode())
|
||||||
|
Loading…
Reference in New Issue
Block a user