Skip to content

Commit

Permalink
tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
Michio Honda committed Nov 3, 2020
1 parent 98e0c2d commit e868551
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ sudo chmod 754 /usr/local/bin/tm
sudo mkdir /usr/local/tm
sudo chmod 775 /usr/local/tm
```

In Ubuntu 18.04
```
sudo cp tm-cleanup.* /lib/systemd/system/
Expand Down
10 changes: 4 additions & 6 deletions tm.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ def reservation(self, argv):
try:
dt = datetime.strptime(args.expire, dtfmt)
except(ValueError):
self.log('expiration date format must be {}, not ',
args.expire, dtfmt)
self.log('expiration date format must be dd/mm/yy'
', not {}'.format(args.expire))
return
if dt < datetime.now():
self.log('date must be on or later than today')
Expand All @@ -121,9 +121,7 @@ def reservation(self, argv):
self.log('14 days of the maximum reservation is set')

if args.func == 'reserve':
if self.set_loader(r['mac'], self.user, args.node):
self.log('{}: reservation successful'.format(args.node))
else:
if not self.set_loader(r['mac'], self.user, args.node):
self.log('{}: failed to create symlink'.format(args.node))
return

Expand Down Expand Up @@ -396,7 +394,7 @@ def set_loader(self, mac, d, node):

def reset_node(self, node, mac):
if not self.set_loader(mac, 'base', node):
print('{}: cannot restore symlink for {}'.format(node, mac))
self.log('{}: cannot restore symlink for {}'.format(node, mac))
for e in ['user', 'expire']:
self.db.update(delete(e), Query().node == node)

Expand Down

0 comments on commit e868551

Please sign in to comment.