Fix bug for ssh.set_config()
This commit is contained in:
parent
6e5131ad46
commit
fec1c66422
|
@ -2,7 +2,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Rattail -- Retail Software Framework
|
# Rattail -- Retail Software Framework
|
||||||
# Copyright © 2010-2018 Lance Edgar
|
# Copyright © 2010-2019 Lance Edgar
|
||||||
#
|
#
|
||||||
# This file is part of Rattail.
|
# This file is part of Rattail.
|
||||||
#
|
#
|
||||||
|
@ -24,8 +24,6 @@
|
||||||
Fabric Library for SSH
|
Fabric Library for SSH
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import unicode_literals, absolute_import
|
|
||||||
|
|
||||||
|
|
||||||
def cache_host_key(c, host, for_user='root'):
|
def cache_host_key(c, host, for_user='root'):
|
||||||
"""
|
"""
|
||||||
|
@ -67,7 +65,7 @@ def set_config(c, setting, value, path='/etc/ssh/sshd_config'):
|
||||||
c.sudo("""bash -c 'echo "{} {}" >> {}'""".format(setting, value, path))
|
c.sudo("""bash -c 'echo "{} {}" >> {}'""".format(setting, value, path))
|
||||||
|
|
||||||
else: # yep, uncomment existing definition, but also overwrite
|
else: # yep, uncomment existing definition, but also overwrite
|
||||||
c.sudo("sed -i .bak -e 's/^#{0} .*/{0} {1}/' {2}".format(setting, value, path))
|
c.sudo("sed -i.bak -e 's/^#{0} .*/{0} {1}/' {2}".format(setting, value, path))
|
||||||
|
|
||||||
else: # setting is defined, so overwrite it
|
else: # setting is defined, so overwrite it
|
||||||
c.sudo("sed -i.bak -e 's/^{0} .*/{0} {1}/' {2}".format(setting, value, path))
|
c.sudo("sed -i.bak -e 's/^{0} .*/{0} {1}/' {2}".format(setting, value, path))
|
||||||
|
|
Loading…
Reference in a new issue