From 9e721636d55d5308df4bdfe4093cf2b2a8a68a20 Mon Sep 17 00:00:00 2001 From: Zolfa Date: Fri, 3 Apr 2020 19:20:24 +0200 Subject: [PATCH] library/gen_passwd.py: from Python 2 to 3 --- MIGRATION.md | 33 +++++++++++++++++---------------- library/gen_passwd.py | 4 ++-- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/MIGRATION.md b/MIGRATION.md index 507af19..6d4cc03 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -18,25 +18,26 @@ On the hosts: ## Roles -| Role name | Modified? | Tested? | Production? | Notes | -|--------------------|:---------:|:--------:|:-----------:|------------------------------------------------------------------------------------------| -|`roles/service` | **YES** | **YES** | NO | Changes in Ansible built-in `apt` module. | -|`roles/ssh_server` | **YES** | **YES** | NO | `lxc_ssh.py` --> `ssh_lxc.py`. | -|`roles/ca` | **YES** | ReadNote | NO | Changes in Ansible built-in `apt` module. Needs update of `ca_manager` to [1] to work. | -|`prepare_host.yaml` | **YES** | **YES** | NO | Debian stretch --> buster and Python 2 --> 3 | -|`roles/ldap` | NO | NO | NO | | -|`roles/nginx` | NO | NO | NO | | -|`roles/projects` | NO | NO | NO | | -|`roles/dns_record` | NO | NO | NO | | -|`roles/openvpn` | NO | NO | NO | | +| Role name | Modified? | Tested? | Production? | Notes | +|--------------------|:---------:|:--------:|:-----------:|----------------------------------------------------------------------| +|`roles/service` | **YES** | **YES** | NO | New `apt` module style for packages. | +|`roles/ssh_server` | **YES** | **YES** | NO | `lxc_ssh.py` --> `ssh_lxc.py`, multi-key support. | +|`roles/ca` | **YES** | ReadNote | NO | New `apt` module style for pacakges. Works with this [ca_manager]. | +|`prepare_host.yaml` | **YES** | **YES** | NO | Migrate Debian release to Buster and Python 2 to 3. | +|`roles/ldap` | NO | NO | NO | | +|`roles/nginx` | NO | NO | NO | | +|`roles/projects` | NO | NO | NO | | +|`roles/dns_record` | NO | NO | NO | | +|`roles/openvpn` | NO | NO | NO | | ## Plugins and Modules -| Plugin/Module name | Modified? | Tested? | Production? | Notes | -|------------------------|:---------:|:---------:|:-----------:|--------------------------------------| -|`connection/lxc_ssh.py` | *REMOVED* | | | | -|`connection/ssh_lxc.py` | **NEW** | **YES** | NO | Replace `lxc_ssh.py`. | -|`library/ssh_cert.py` | **YES** | **YES** | NO | Migrate from `python2` to `python3`. | +| Plugin/Module name | Modified? | Tested? | Production? | Notes | +|------------------------|:---------:|:---------:|:-----------:|-----------------------------| +|`connection/lxc_ssh.py` | *REMOVED* | | | | +|`connection/ssh_lxc.py` | **NEW** | **YES** | NO | Replace `lxc_ssh.py`. | +|`library/ssh_cert.py` | **YES** | **YES** | NO | Migrate Python 2 to 3. | +|`library/gen_passwd.py` | **YES** | **YES** | NO | Migrate Python 2 to 3. | [1]: https://github.com/LILiK-117bis/ca_manager/tree/peewee3%2Brfc5280 diff --git a/library/gen_passwd.py b/library/gen_passwd.py index 5d0385a..9b4530c 100644 --- a/library/gen_passwd.py +++ b/library/gen_passwd.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- DOCUMENTATION = ''' @@ -39,7 +39,7 @@ def main(): valid_chars = string.ascii_uppercase + string.ascii_lowercase + \ string.digits - passwd = [rng.choice(valid_chars) for _ in xrange(length)] + passwd = [rng.choice(valid_chars) for _ in range(length)] result['passwd'] = ''.join(passwd)