in cookbooks/aws-parallelcluster-environment/files/default/ec2_udev_rules/manageVolume.py [0:0]
def get_all_devices():
# lsblk -d -n
# xvda 202:0 0 17G 0 disk
# xvdb 202:16 0 20G 0 disk /shared
command = ["/bin/lsblk", "-d", "-n"]
try:
# fmt: off
# All commands and arguments in this subprocess call are built as literals.
output = subprocess.check_output( # nosec
command, stderr=subprocess.STDOUT, universal_newlines=True
).split("\n")
# fmt: on
return [f"/dev/{line.split()[0]}" for line in output if len(line.split()) > 0]
except subprocess.CalledProcessError as e:
print("Failed to get devices with lsblk -d -n")
raise e