pysite

pysite has several subcommands to manage your PySite setup: you can manage principals (users), roles and role memberships as well as install new sites and check the integrity of existing sites.

The subcommands are:

list-principals     List principals
create-principal       Create principal
update-principal    Update principal with given ID
delete-principal    Delete principal with given ID
list-roles          List roles
create-role            Create role
update-role         Update role with given ID
delete-role         Delete role with given ID
list-rolemembers    List rolemembers
create-rolemember      Create rolemember
delete-rolemember   Delete rolemember with given ID
list-sites          List sites
create-site            Create site

Type pysite -h for general help and a list of the subcommands, pysite subcommand -h to get help for that subcommand.

pysite allows you to use different formats for input and output. Choices are json, yaml (default) and tsv.

Tsv is handy if you want to review the output in a spreadsheet:

pysite -c production.ini --format tsv list-principals > a && gnumeric a

Both, json and yaml allow inline-style. Here is an example of inline YAML:

pysite -c production.ini --format yaml create-principal \
    '{principal: FOO5, email: foo5@here, pwd: FOO, roles: [foo, bar]}'
TTY? True
Locale? en_GB UTF-8
id: 106
display_name: FOO5
email: foo5@here
first_name: null
gui_token: null
identity_url: null
is_blocked: false
is_enabled: false
last_name: null
login_time: null
notes: null
prev_login_time: null
principal: FOO5
pwd: FOO
owner: 2
ctime: '2012-12-07 07:47:23'
editor: null
mtime: null
role_names:
- foo
- bar
- users
Done.

Here is an example of creating a new site:

pysite -c production.ini --format yaml create-site '{sitename: www.new-site.com, principal: {principal: sally, email: sally@example.com, pwd: FOO, first_name: Sally, last_name: Müller-Lüdenscheidt, roles: [some_role, other_role]}, title: Neue Site, site_template: default}'
TTY? True
Locale? en_GB UTF-8
Proceed to create a site in /tmp/sites (yes/NO)? yes
Copied template [...]/var/site-templates/default
Createed role 'www.new-site.com' (108)
Createed principal 'sally' (111)
Set principal 'sally' as member of role 'www.new-site.com'
Done.

To get an overview, which user is in which role, and if there are orphans (should not), do:

pysite -c production.ini --format tsv list-rolemembers > a && gnumeric a

Previous topic

Hilfe

Next topic

pysite.sitemgr

This Page