Skip to content

Commit bf0cbb1

Browse files
Call sonic-kdump-config --remote after setting ssh_path and ssh_string (#319) (#332)
sonic-kdump-config --remote command comments/uncomments the ssh_path and ssh_string based on the boolean in CONFIG_DB KDUMp table. This should be called after setting both ssh_string and ssh_path.
1 parent e694db2 commit bf0cbb1

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

scripts/hostcfgd

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,19 +1254,20 @@ class KdumpCfg(object):
12541254
num_dumps = data.get("num_dumps")
12551255
run_cmd(["sonic-kdump-config", "--num_dumps", num_dumps])
12561256

1257-
# Remote option
1258-
remote = self.kdump_defaults["remote"]
1259-
if data.get("remote") is not None:
1260-
remote = data.get("remote")
1261-
run_cmd(["sonic-kdump-config", "--remote", remote])
1262-
1257+
# ssh_string
12631258
ssh_string = self.kdump_defaults["ssh_string"]
12641259
if data.get("ssh_string") is not None:
1265-
run_cmd(["sonic-kdump-config", "--ssh_string", ssh_string])
1260+
ssh_string = data.get("ssh_string")
1261+
run_cmd(["sonic-kdump-config", "--ssh_string", ssh_string])
1262+
12661263
# ssh_path
1267-
ssh_path= self.kdump_defaults["ssh_path"]
1264+
ssh_path = self.kdump_defaults["ssh_path"]
12681265
if data.get("ssh_path") is not None:
1269-
run_cmd(["sonic-kdump-config", "--ssh_path", ssh_path])
1266+
ssh_path = data.get("ssh_path")
1267+
run_cmd(["sonic-kdump-config", "--ssh_path", ssh_path])
1268+
1269+
# Remote option
1270+
run_cmd(["sonic-kdump-config", "--remote"])
12701271

12711272
class NtpCfg(object):
12721273
"""

tests/hostcfgd/hostcfgd_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def test_kdump_event(self):
214214
call(['sonic-kdump-config', '--disable']),
215215
call(['sonic-kdump-config', '--num_dumps', '3']),
216216
call(['sonic-kdump-config', '--memory', '0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-16G:448M,16G-32G:768M,32G-:1G']),
217-
call(['sonic-kdump-config', '--remote', 'false']), # Covering remote
217+
call(['sonic-kdump-config', '--remote']), # Covering remote
218218
call(['sonic-kdump-config', '--ssh_string', 'user@localhost']), # Covering ssh_string
219219
call(['sonic-kdump-config', '--ssh_path', '/a/b/c']) # Covering ssh_path
220220
]
@@ -235,7 +235,7 @@ def test_kdump_load(self):
235235
call(['sonic-kdump-config', '--enable']),
236236
call(['sonic-kdump-config', '--num_dumps', '3']),
237237
call(['sonic-kdump-config', '--memory', '0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-16G:448M,16G-32G:768M,32G-:1G']),
238-
call(['sonic-kdump-config', '--remote', 'false']), # Covering remote
238+
call(['sonic-kdump-config', '--remote']), # Covering remote
239239
call(['sonic-kdump-config', '--ssh_string', 'user@localhost']), # Covering ssh_string
240240
call(['sonic-kdump-config', '--ssh_path', '/a/b/c']) # Covering ssh_path
241241
]
@@ -263,7 +263,7 @@ def test_kdump_event_with_proc_cmdline(self):
263263
call(['sonic-kdump-config', '--enable']),
264264
call(['sonic-kdump-config', '--num_dumps', '3']),
265265
call(['sonic-kdump-config', '--memory', '8G-:1G']),
266-
call(['sonic-kdump-config', '--remote', 'false']), # Covering remote
266+
call(['sonic-kdump-config', '--remote']), # Covering remote
267267
call(['sonic-kdump-config', '--ssh_string', 'user@localhost']), # Covering ssh_string
268268
call(['sonic-kdump-config', '--ssh_path', '/a/b/c']) # Covering ssh_path
269269
]

0 commit comments

Comments
 (0)