summaryrefslogtreecommitdiff
path: root/src/op_mode
diff options
context:
space:
mode:
authorThomas Mangin <thomas.mangin@exa.net.uk>2020-04-05 18:35:25 +0100
committerThomas Mangin <thomas.mangin@exa.net.uk>2020-04-06 20:22:35 +0100
commit289be9256aedae0995ee5e0198fa256c2d450586 (patch)
treef52391987701ffd3529875a1a5b0903e79a59800 /src/op_mode
parent87f0c0b4bba1f8903ec33757c6cb57c49674bfeb (diff)
downloadvyos-1x-289be9256aedae0995ee5e0198fa256c2d450586.tar.gz
vyos-1x-289be9256aedae0995ee5e0198fa256c2d450586.zip
util: T2226: rewrite gen sh key to use run,cmd
Diffstat (limited to 'src/op_mode')
-rwxr-xr-xsrc/op_mode/generate_ssh_server_key.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/op_mode/generate_ssh_server_key.py b/src/op_mode/generate_ssh_server_key.py
index f205919b8..f65d383c0 100755
--- a/src/op_mode/generate_ssh_server_key.py
+++ b/src/op_mode/generate_ssh_server_key.py
@@ -14,14 +14,14 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import subprocess
import sys
from vyos.util import ask_yes_no
+from vyos.util import cmd
if not ask_yes_no('Do you really want to remove the existing SSH host keys?'):
sys.exit(0)
-else:
- subprocess.check_call(['sudo rm -v /etc/ssh/ssh_host_*'], shell=True)
- subprocess.check_call(['sudo dpkg-reconfigure openssh-server'], shell=True)
- subprocess.check_call(['sudo systemctl restart ssh'], shell=True)
+
+cmd('sudo rm -v /etc/ssh/ssh_host_*')
+cmd('sudo dpkg-reconfigure openssh-server')
+cmd('sudo systemctl restart ssh')