Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review scripts in bin/ #108

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions bin/ws_find
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

from __future__ import print_function

import os, os.path, pwd, grp, sys
import os, os.path, pwd, grp, sys, yaml
from optparse import OptionParser


Expand All @@ -55,8 +55,6 @@ def read_python_conf():

read_python_conf()

import yaml

# who are we?
uid = os.getuid()
gid = os.getgid()
Expand Down Expand Up @@ -89,7 +87,7 @@ if options.filesystem:
if options.filesystem in config["workspaces"]:
filesystems = [options.filesystem]
else:
print("Error: no such filesystem.")
print("Error: no such filesystem.", file=sys.stderr)
sys.exit(-1)
else:
filesystems = config["workspaces"].keys()
Expand Down Expand Up @@ -121,10 +119,12 @@ if options.list:
print(i)
sys.exit(0)

# Print usage, if no argument provided
if len(args) == 0:
print(usage, file=sys.stderr)
sys.exit(-1)

# Retrieve ws name as first argument
wsname = args[0]

# main loop
Expand Down
5 changes: 1 addition & 4 deletions bin/ws_register
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
from __future__ import print_function

import os, os.path, pwd, grp, sys
import glob
import glob, yaml
import argparse
import pathlib

Expand All @@ -61,9 +61,6 @@ def read_python_conf():

read_python_conf()

import yaml


# who are we?
uid = os.getuid()
username = pwd.getpwuid(uid).pw_name
Expand Down
9 changes: 6 additions & 3 deletions bin/ws_send_ical
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

python version of ws_send_ical command, no privileges necessary

send a rminder as VCALENDAR entry for a named workspace to the
address.
send a reminder as VCALENDAR entry for a named workspace to the
address.

Reads new YAML configuration files and new YAML workspace database.

Expand Down Expand Up @@ -43,6 +43,7 @@ from __future__ import print_function
import os, os.path, pwd, grp, sys
import glob, time
from optparse import OptionParser
import getpass

### from datetime import datetime, date, time
import smtplib
Expand Down Expand Up @@ -174,7 +175,9 @@ def send_ical(entry, smtphost, resource, attendee, mail_from, login, ws_name, cr
# so we have to determine user and read config first, and parse commandline last

# who are we?
login = os.getlogin()
# https://bugs.python.org/issue32651
login = getpass.getuser()
# login = os.getlogin()
create_time = time.strftime("%Y%m%dT%H%M00", time.localtime(None))
uid = os.getuid()
gid = os.getgid()
Expand Down
73 changes: 36 additions & 37 deletions ws.conf_full_sample
Original file line number Diff line number Diff line change
@@ -1,39 +1,38 @@
# this file illustrates and documents the workspace++ config files
# this is a YAML file, view with tabstop=8
# use ws_validate_config to validate a config file
clustername: aName # mandantory, a name to identify the system
smtphost: localhosti # mandantory, a host accepting smtp connections to send emails
mail_from: [email protected] # sender address for reminders
default: lustre # mandantory, the default workspace to choose
duration: 10 # mantantory, the max duration in days, if not specified in workspace
durationdefault: 1 # optional, if user does not give duration, this will be used
reminderdefault: 0 # optional, if set, users will always get mail, in doubt local mail to username
maxextensions: 1 # mandantory, the number of extensions, if not specified in workspace
pythonpath: /path/to/my/python # optional, path which is appended to python search path for ws_list and other pythons scripts to find yaml
dbuid: 9999 # mandantory
dbgid: 9999 # mandantory
admins: [hobel] # list of admin users, for ws_list
deldir_timeout: 3600 # maximum time in secs to delete a single workspace.
workspaces: # now the list of the workspaces
lustre: # name of workspace as shown with ws_list -l
keeptime: 1 # mandantory, time in days to keep workspaces after they expired
spaces: [/lustre1/ws, /lustre2/ws] # mandantory, list of directories
spaceselection: random # "random" (default), "uid" (uid%#spaces), "gid" (gid%#spaces)
deleted: .removed # mandantory, will be appended to spaces and database
# to move deleted files to
database: /lustre-db # mandantory, the DB directory, this is where DB files will end
duration: 30 # max duration, overwrites global value
groupdefault: [inst1,inst2] # users of those groups will have this workspace as default
userdefault: [user1] # those users will have this workspace as default
user_acl: [user1] # as soon as user_acl or group_acl exist,
# the workspace is access restricted to those users/groups listed
group_acl: [adm]
maxextensions: 5 # maximum extensios allowed
allocatable: no # do not allow new allocations in this workspace if no
extendable: no # do not allow extensions in this workspace if no
restorable: no # do not allow restores from this workspace if no
nfs: # second workspace, minimum example
keeptime: 1 # mandantory, time in days to keep workspaces after they expired
database: /nfs-db
spaces: [/nfs1/ws]
deleted: .trash
clustername: aName # mandatory, a name to identify the system
smtphost: localhosti # mandatory, a host accepting smtp connections to send emails
mail_from: [email protected] # sender address for reminders
default: lustre # mandatory, the default workspace to choose
duration: 10 # mandatory, the max duration in days, if not specified in workspace
durationdefault: 1 # optional, if user does not give duration, this will be used
reminderdefault: 0 # optional, if set, users will always get mail, in doubt local mail to username
maxextensions: 1 # mandatory, the number of extensions, if not specified in workspace
pythonpath: /path/to/my/python # optional, path which is appended to python search path for ws_list and other pythons scripts to find yaml
dbuid: 9999 # mandatory
dbgid: 9999 # mandatory
admins: [hobel] # list of admin users, for ws_list
deldir_timeout: 3600 # maximum time in secs to delete a single workspace.
workspaces: # now the list of the workspaces
lustre: # name of workspace as shown with ws_list -l
keeptime: 1 # mandatory, time in days to keep workspaces after they expired
spaces: [/lustre1/ws, /lustre2/ws] # mandatory, list of directories
spaceselection: random # "random" (default), "uid" (uid%#spaces), "gid" (gid%#spaces)
deleted: .removed # mandatory, will be appended to spaces and database
# to move deleted files to
database: /lustre-db # mandatory, the DB directory, this is where DB files will end
duration: 30 # max duration, overwrites global value
groupdefault: [inst1,inst2] # users of those groups will have this workspace as default
userdefault: [user1] # those users will have this workspace as default
user_acl: [user1] # as soon as user_acl or group_acl exist,
# the workspace is access restricted to those users/groups listed
group_acl: [adm]
maxextensions: 5 # maximum extensions allowed
allocatable: no # do not allow new allocations in this workspace if no
extendable: no # do not allow extensions in this workspace if no
restorable: no # do not allow restores from this workspace if no
nfs: # second workspace, minimum example
keeptime: 1 # mandatory, time in days to keep workspaces after they expired
database: /nfs-db
spaces: [/nfs1/ws]
deleted: .trash