MCPcopy Create free account
hub / github.com/apache/cloudstack / del_l2tp_ipsec_user

Method del_l2tp_ipsec_user

systemvm/debian/opt/cloud/bin/configure.py:1188–1213  ·  view source on GitHub ↗
(self, user, obj)

Source from the content-addressed store, hash-verified

1186 file.commit()
1187
1188 def del_l2tp_ipsec_user(self, user, obj):
1189 userfound = False
1190 password = obj['password']
1191 userentry = "%s * %s *" % (user, password)
1192
1193 logging.debug("Deleting the user '%s'" % user)
1194 file = CsFile(self.PPP_CHAP)
1195 file.deleteLine(userentry)
1196 file.commit()
1197
1198 if not os.path.exists('/var/run/pppd2.tdb'):
1199 return
1200
1201 logging.debug("killing the PPPD process for the user '%s'" % user)
1202
1203 fileContents = CsHelper.execute("tdbdump /var/run/pppd2.tdb")
1204 for line in fileContents:
1205 if user in line:
1206 contentlist = line.split(';')
1207 for str in contentlist:
1208 pppd = str.split('=')[0]
1209 if pppd == 'PPPD_PID':
1210 pid = str.split('=')[1]
1211 if pid:
1212 logging.debug("killing process %s" % pid)
1213 CsHelper.execute('kill -9 %s' % pid)
1214
1215
1216class CsRemoteAccessVpn(CsDataBag):

Callers 2

processMethod · 0.95
add_l2tp_ipsec_userMethod · 0.95

Calls 6

deleteLineMethod · 0.95
commitMethod · 0.95
CsFileClass · 0.90
debugMethod · 0.80
existsMethod · 0.65
executeMethod · 0.65

Tested by

no test coverage detected