Skip to content

Commit

Permalink
fix: add check for list file is a file
Browse files Browse the repository at this point in the history
  • Loading branch information
MatteoGuadrini committed Feb 1, 2024
1 parent a456005 commit 8fc233d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bb.py
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,7 @@ def deploy_configuration(computer, user):
computer
)
)
exit(2)
else:
utility.warning("Public key ~/.ssh/id_rsa.pub is not exist")
exit(2)
Expand Down Expand Up @@ -1694,13 +1695,14 @@ def main():
# Computer list
hostnames.append(args.hostname)
elif args.list:
if os.path.exists(args.list):
if os.path.exists(args.list) and os.path.isfile(args.list):
list_file = open(args.list, "r").read().split()
for line in list_file:
# Computer list
hostnames.append(line)
else:
utility.error("The file {0} not exist!".format(args.list))
utility.error("The file {0} not exist or is a directory!".format(args.list))
exit(1)
else:
parser.print_usage()
print("For backup usage, --help or -h")
Expand Down

0 comments on commit 8fc233d

Please sign in to comment.