def update(self): buf = StringIO.StringIO() buf.seek(0, os.SEEK_SET) buf.truncate() buf.write(self.content) buf.seek(0, os.SEEK_SET) put(buf, self.filepath, self.use_sudo)
def git_config(): buf = StringIO.StringIO(GITCFG % ( rlinput('name: ', config['name']), rlinput('email: ', config['email']), rlinput('signingkey: ', config['signingkey']), rlinput('editor: ', config['editor']), )) put(buf, '~/.gitconfig')
def sysctl(): netconf = '/etc/sysctl.d/net.conf' buf = StringIO.StringIO(b'''\ net.ipv4.tcp_congestion_control = htcp net.core.rmem_default = 2621440 net.core.rmem_max = 16777216 net.core.wmem_default = 655360 net.core.wmem_max = 16777216 net.ipv4.tcp_rmem = 4096 2621440 16777216 net.ipv4.tcp_wmem = 4096 655360 16777216 ''') put(buf, netconf, use_sudo=True) sudo('chown root.root %s' % netconf) sudo('sysctl -p /etc/sysctl.d/net.conf')
def sysctl(): netconf = '/etc/sysctl.d/net.conf' buf = StringIO.StringIO(b'''\ net.ipv4.tcp_congestion_control = bbr net.core.rmem_default = 2621440 net.core.rmem_max = 16777216 net.core.wmem_default = 655360 net.core.wmem_max = 16777216 net.ipv4.tcp_rmem = 4096 2621440 16777216 net.ipv4.tcp_wmem = 4096 655360 16777216 net.ipv4.tcp_retries2 = 8 ''') put(buf, netconf, use_sudo=True) sudo('chown root.root %s' % netconf) sudo('sysctl -p /etc/sysctl.d/net.conf')