Compare commits
7 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9f441164e7 | |||
| 1d2d4697ec | |||
| 1c7883393b | |||
| 94c170f9f7 | |||
| 47ec0c67ca | |||
| 8bddce1329 | |||
| 542875a44c |
13 changed files with 55 additions and 21 deletions
12
CHANGELOG.md
12
CHANGELOG.md
|
|
@ -5,6 +5,18 @@ All notable changes to rattail-fabric2 will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## v0.4.6 (2025-09-06)
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- add `apt.is_installed()` function
|
||||||
|
|
||||||
|
## v0.4.5 (2025-02-01)
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- purge email settings for wuttjamaican also
|
||||||
|
|
||||||
## v0.4.4 (2024-10-03)
|
## v0.4.4 (2024-10-03)
|
||||||
|
|
||||||
### Fix
|
### Fix
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ build-backend = "hatchling.build"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "rattail-fabric2"
|
name = "rattail-fabric2"
|
||||||
version = "0.4.4"
|
version = "0.4.6"
|
||||||
description = "Fabric (v2) Utilities for Rattail"
|
description = "Fabric (v2) Utilities for Rattail"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = [{name = "Lance Edgar", email = "lance@edbob.org"}]
|
authors = [{name = "Lance Edgar", email = "lance@edbob.org"}]
|
||||||
|
|
|
||||||
|
|
@ -146,18 +146,18 @@ def restart(c):
|
||||||
"""
|
"""
|
||||||
Restart the Apache web service
|
Restart the Apache web service
|
||||||
"""
|
"""
|
||||||
c.sudo('systemctl restart apache2.service')
|
c.sudo("service apache2 restart")
|
||||||
|
|
||||||
|
|
||||||
def stop(c):
|
def stop(c):
|
||||||
"""
|
"""
|
||||||
Stop the Apache web service
|
Stop the Apache web service
|
||||||
"""
|
"""
|
||||||
c.sudo('systemctl stop apache2.service')
|
c.sudo("service apache2 stop")
|
||||||
|
|
||||||
|
|
||||||
def start(c):
|
def start(c):
|
||||||
"""
|
"""
|
||||||
Start the Apache web service
|
Start the Apache web service
|
||||||
"""
|
"""
|
||||||
c.sudo('systemctl start apache2.service')
|
c.sudo("service apache2 start")
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Rattail -- Retail Software Framework
|
# Rattail -- Retail Software Framework
|
||||||
# Copyright © 2010-2018 Lance Edgar
|
# Copyright © 2010-2025 Lance Edgar
|
||||||
#
|
#
|
||||||
# This file is part of Rattail.
|
# This file is part of Rattail.
|
||||||
#
|
#
|
||||||
|
|
@ -44,6 +44,19 @@ def install(c, *packages, **kwargs):
|
||||||
frontend, target, force_yes, ' '.join(packages)), **kwargs)
|
frontend, target, force_yes, ' '.join(packages)), **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
def is_installed(c, package):
|
||||||
|
"""
|
||||||
|
Check if the given APT package is installed.
|
||||||
|
|
||||||
|
:param c: Fabric connection.
|
||||||
|
|
||||||
|
:param package: Name of package to be checked.
|
||||||
|
|
||||||
|
:returns: ``True`` if package is installed, else ``False``.
|
||||||
|
"""
|
||||||
|
return c.run(f"dpkg-query -s {package}", warn=True).ok
|
||||||
|
|
||||||
|
|
||||||
def purge(c, *packages):
|
def purge(c, *packages):
|
||||||
"""
|
"""
|
||||||
Uninstall and purge config for given packages
|
Uninstall and purge config for given packages
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ def restart(c):
|
||||||
"""
|
"""
|
||||||
Restart the collectd service.
|
Restart the collectd service.
|
||||||
"""
|
"""
|
||||||
c.sudo('systemctl restart collectd')
|
c.sudo("service collectd restart")
|
||||||
|
|
||||||
|
|
||||||
def deploy_mountpoint_check_script(c, dest, **kwargs):
|
def deploy_mountpoint_check_script(c, dest, **kwargs):
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,9 @@ fi
|
||||||
PIP="sudo -H -u ${user} PIP_CONFIG_FILE=${envpath}/pip.conf ${envpath}/bin/pip"
|
PIP="sudo -H -u ${user} PIP_CONFIG_FILE=${envpath}/pip.conf ${envpath}/bin/pip"
|
||||||
|
|
||||||
|
|
||||||
# upgrade pip
|
# upgrade pip & friends
|
||||||
$PIP install $QUIET $PROGRESSBAR --upgrade pip
|
$PIP install $QUIET $PROGRESSBAR --upgrade pip
|
||||||
|
$PIP install $QUIET $PROGRESSBAR --upgrade setuptools wheel
|
||||||
|
|
||||||
# upgrade rattail
|
# upgrade rattail
|
||||||
cd ${envpath}/src/rattail
|
cd ${envpath}/src/rattail
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ def restart(c):
|
||||||
"""
|
"""
|
||||||
Restart the MySQL database service
|
Restart the MySQL database service
|
||||||
"""
|
"""
|
||||||
c.sudo('systemctl restart mysql.service')
|
c.sudo("service mysql restart")
|
||||||
|
|
||||||
|
|
||||||
def user_exists(c, name, host='localhost'):
|
def user_exists(c, name, host='localhost'):
|
||||||
|
|
|
||||||
|
|
@ -50,8 +50,8 @@ def install(c, version=None, user=None):
|
||||||
c.sudo(f'touch {profile}')
|
c.sudo(f'touch {profile}')
|
||||||
c.sudo(f'chown {user}: {profile}')
|
c.sudo(f'chown {user}: {profile}')
|
||||||
append(c, profile, 'export NVM_DIR="{}"'.format(nvm), **kwargs)
|
append(c, profile, 'export NVM_DIR="{}"'.format(nvm), **kwargs)
|
||||||
append(c, profile, '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"', **kwargs)
|
append(c, profile, '[ -s "$NVM_DIR/nvm.sh" ] && \\. "$NVM_DIR/nvm.sh"', **kwargs)
|
||||||
append(c, profile, '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"', **kwargs)
|
append(c, profile, '[ -s "$NVM_DIR/bash_completion" ] && \\. "$NVM_DIR/bash_completion"', **kwargs)
|
||||||
|
|
||||||
node = version or 'node'
|
node = version or 'node'
|
||||||
cmd = "bash -l -c 'nvm install {}'".format(node)
|
cmd = "bash -l -c 'nvm install {}'".format(node)
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ def restart(c):
|
||||||
"""
|
"""
|
||||||
Restart the Postfix mail service
|
Restart the Postfix mail service
|
||||||
"""
|
"""
|
||||||
c.sudo('systemctl restart postfix.service')
|
c.sudo("service postfix restart")
|
||||||
|
|
||||||
|
|
||||||
def set_config(c, setting, value):
|
def set_config(c, setting, value):
|
||||||
|
|
|
||||||
|
|
@ -93,14 +93,14 @@ def restart(c):
|
||||||
"""
|
"""
|
||||||
Restart the PostgreSQL database service
|
Restart the PostgreSQL database service
|
||||||
"""
|
"""
|
||||||
c.sudo('systemctl restart postgresql.service')
|
c.sudo("service postgresql restart")
|
||||||
|
|
||||||
|
|
||||||
def reload_(c):
|
def reload_(c):
|
||||||
"""
|
"""
|
||||||
Reload config for the PostgreSQL database service
|
Reload config for the PostgreSQL database service
|
||||||
"""
|
"""
|
||||||
c.sudo('systemctl reload postgresql.service')
|
c.sudo("service postgresql reload")
|
||||||
|
|
||||||
# TODO: deprecate / remove this
|
# TODO: deprecate / remove this
|
||||||
reload = reload_
|
reload = reload_
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,14 @@ def delete_email_recipients(c, dbname):
|
||||||
"""
|
"""
|
||||||
Purge all email recipient settings for the given database.
|
Purge all email recipient settings for the given database.
|
||||||
"""
|
"""
|
||||||
|
# purge new-style for wuttjamaican
|
||||||
|
postgresql.sql(c, "delete from setting where name like 'rattail.email.%.sender';", database=dbname)
|
||||||
|
postgresql.sql(c, "delete from setting where name like 'rattail.email.%.to';", database=dbname)
|
||||||
|
postgresql.sql(c, "delete from setting where name like 'rattail.email.%.cc';", database=dbname)
|
||||||
|
postgresql.sql(c, "delete from setting where name like 'rattail.email.%.bcc';", database=dbname)
|
||||||
|
|
||||||
|
# purge old-style for rattail
|
||||||
|
postgresql.sql(c, "delete from setting where name like 'rattail.mail.%.from';", database=dbname)
|
||||||
postgresql.sql(c, "delete from setting where name like 'rattail.mail.%.to';", database=dbname)
|
postgresql.sql(c, "delete from setting where name like 'rattail.mail.%.to';", database=dbname)
|
||||||
postgresql.sql(c, "delete from setting where name like 'rattail.mail.%.cc';", database=dbname)
|
postgresql.sql(c, "delete from setting where name like 'rattail.mail.%.cc';", database=dbname)
|
||||||
postgresql.sql(c, "delete from setting where name like 'rattail.mail.%.bcc';", database=dbname)
|
postgresql.sql(c, "delete from setting where name like 'rattail.mail.%.bcc';", database=dbname)
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ def restart(c):
|
||||||
"""
|
"""
|
||||||
Restart the OpenSSH service
|
Restart the OpenSSH service
|
||||||
"""
|
"""
|
||||||
c.sudo('systemctl restart ssh.service')
|
c.sudo("service ssh restart")
|
||||||
|
|
||||||
|
|
||||||
def configure(c, allow_root=False):
|
def configure(c, allow_root=False):
|
||||||
|
|
|
||||||
|
|
@ -154,8 +154,8 @@ def is_win(c):
|
||||||
"""
|
"""
|
||||||
Return True if remote SSH server is running Windows, False otherwise.
|
Return True if remote SSH server is running Windows, False otherwise.
|
||||||
|
|
||||||
The idea is based on echoing quoted text: \*NIX systems will echo quoted
|
The idea is based on echoing quoted text: \\*NIX systems will echo
|
||||||
text only, while Windows echoes quotation marks as well.
|
quoted text only, while Windows echoes quotation marks as well.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
|
|
@ -170,7 +170,7 @@ def _expand_path(c, path):
|
||||||
Return a path expansion
|
Return a path expansion
|
||||||
|
|
||||||
E.g. ~/some/path -> /home/myuser/some/path
|
E.g. ~/some/path -> /home/myuser/some/path
|
||||||
/user/\*/share -> /user/local/share
|
/user/\\*/share -> /user/local/share
|
||||||
More examples can be found here: http://linuxcommand.org/lc3_lts0080.php
|
More examples can be found here: http://linuxcommand.org/lc3_lts0080.php
|
||||||
|
|
||||||
.. versionchanged:: 1.0
|
.. versionchanged:: 1.0
|
||||||
|
|
@ -207,10 +207,10 @@ def sed(c, filename, before, after, limit='', use_sudo=False, backup='.bak',
|
||||||
<filename>``. Setting ``backup`` to an empty string will, disable backup
|
<filename>``. Setting ``backup`` to an empty string will, disable backup
|
||||||
file creation.
|
file creation.
|
||||||
|
|
||||||
For convenience, ``before`` and ``after`` will automatically escape forward
|
For convenience, ``before`` and ``after`` will automatically
|
||||||
slashes, single quotes and parentheses for you, so you don't need to
|
escape forward slashes, single quotes and parentheses for you, so
|
||||||
specify e.g. ``http:\/\/foo\.com``, instead just using ``http://foo\.com``
|
you don't need to specify e.g. ``http:\\/\\/foo\\.com``, instead
|
||||||
is fine.
|
just using ``http://foo\\.com`` is fine.
|
||||||
|
|
||||||
If ``use_sudo`` is True, will use `sudo` instead of `run`.
|
If ``use_sudo`` is True, will use `sudo` instead of `run`.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue