MCPcopy Index your code
hub / github.com/saltstack/salt / dump

Function dump

salt/modules/disk.py:416–453  ·  view source on GitHub ↗

Return all contents of dumpe2fs for a specified device device The device path to dump. args A list of attributes to return. Returns all by default. CLI Example: .. code-block:: bash salt '*' disk.dump /dev/sda1

(device, args=None)

Source from the content-addressed store, hash-verified

414
415
416def dump(device, args=None):
417 """
418 Return all contents of dumpe2fs for a specified device
419
420 device
421 The device path to dump.
422
423 args
424 A list of attributes to return. Returns all by default.
425
426 CLI Example:
427
428 .. code-block:: bash
429
430 salt '*' disk.dump /dev/sda1
431 """
432 cmd = (
433 "blockdev --getro --getsz --getss --getpbsz --getiomin --getioopt --getalignoff"
434 " --getmaxsect --getsize --getsize64 --getra --getfra {}".format(device)
435 )
436 ret = {}
437 opts = [c[2:] for c in cmd.split() if c.startswith("--")]
438 out = __salt__["cmd.run_all"](cmd, python_shell=False)
439 if out["retcode"] == 0:
440 lines = [line for line in out["stdout"].splitlines() if line]
441 count = 0
442 for line in lines:
443 ret[opts[count]] = line
444 count = count + 1
445 if args:
446 temp_ret = {}
447 for arg in args:
448 temp_ret[arg] = ret[arg]
449 return temp_ret
450 else:
451 return ret
452 else:
453 return False
454
455
456def resize2fs(device):

Callers 1

tuneFunction · 0.70

Calls 1

formatMethod · 0.80

Tested by

no test coverage detected