Skip to content

Enhance setup.sh email list#1898

Merged
casperklein merged 4 commits intomasterfrom
casperklein-patch-1
Apr 12, 2021
Merged

Enhance setup.sh email list#1898
casperklein merged 4 commits intomasterfrom
casperklein-patch-1

Conversation

@casperklein
Copy link
Copy Markdown
Member

@casperklein casperklein commented Apr 12, 2021

Description

Display an enhanced all-in-one ./setup.sh email list with quotas, disk usage and aliases for each user with one single command.

The ./setup.sh email list command output looks like this :

Implements #1892

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (non-breaking change that does improve existing functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (README.md or ENVIRONMENT.md or the documentation)
  • If necessary I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@casperklein casperklein self-assigned this Apr 12, 2021
@casperklein casperklein added area/enhancement kind/improvement Improve an existing feature, configuration file or the documentation labels Apr 12, 2021
@casperklein casperklein marked this pull request as ready for review April 12, 2021 08:21
@casperklein casperklein requested a review from a team April 12, 2021 08:21
Copy link
Copy Markdown
Member

@wernerfred wernerfred left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does the output look like if there is no quota enabled/set?

@georglauterbach
Copy link
Copy Markdown
Member

How does the output look like if there is no quota enabled/set?

There should be no line with [ aliases -> ... at all as far as I can see.

@casperklein
Copy link
Copy Markdown
Member Author

How does the output look like if there is no quota enabled/set?

Like in the provided example. ~ for no quota defined: * [email protected] ( 1,9M / ~ )

The aliases line is only shown when there are aliases configured.

Comment thread target/bin/listmailuser
@polarathene
Copy link
Copy Markdown
Member

polarathene commented Oct 23, 2021

@casperklein this PR introduced a regression as identified via setup email list output here:

* [email protected] ( 0 / ~ ) [0%]
    [ aliases -> [email protected], @localdomain2.com]

* [email protected] ( 0 / ~ ) [0%]

* [email protected] ( 0 / ~ ) [0%]

doveadm(# this is a test comment, please don't delete me :'(): Error: User doesn't exist
/usr/local/bin/listmailuser: line 12: 1024 *  : syntax error: operand expected (error token is "*  ")
/usr/local/bin/listmailuser: line 12: 1024 *  : syntax error: operand expected (error token is "*  ")
* # this is a test comment, please don't delete me :'( (  /  ) [%]
    [ aliases -> #]

doveadm(# this is also a test comment, :O): Error: User doesn't exist
/usr/local/bin/listmailuser: line 12: 1024 *  : syntax error: operand expected (error token is "*  ")
/usr/local/bin/listmailuser: line 12: 1024 *  : syntax error: operand expected (error token is "*  ")
* # this is also a test comment, :O (  /  ) [%]
    [ aliases -> #]

Comment support for this utility was previously implemented via this PR with the line:

(grep -v "^\s*$\|^\s*\#" "$DATABASE" || true) | awk -F '|' '{ print $1; }'

But your changes appear to have broken that? I think we could add a test (I don't mind writing the test), to check that the output doesn't contain the comments to avoid this in future?

@georglauterbach
Copy link
Copy Markdown
Member

This regression should be an easy fix though, right? Just re-adding the grep?

@polarathene
Copy link
Copy Markdown
Member

This regression should be an easy fix though, right? Just re-adding the grep?

I assume so?

I am working on a PR to merge for check-for-changes.sh after existing ones are merged to remove it's copies of other code that's fallen out of sync. One of the lines has similar grep to filter out comments, I extracted that out into a function instead into helper-functions.sh:

# Remove string input with only whitespace or `#` as the first non-whitespace character.
function _strip_comments
{
  grep -q -E "^\s*$|^\s*#" <<< "${1}"
}

@georglauterbach
Copy link
Copy Markdown
Member

This regression should be an easy fix though, right? Just re-adding the grep?

I assume so?

I am working on a PR to merge for check-for-changes.sh after existing ones are merged to remove it's copies of other code that's fallen out of sync. One of the lines has similar grep to filter out comments, I extracted that out into a function instead into helper-functions.sh:

# Remove string input with only whitespace or `#` as the first non-whitespace character.
function _strip_comments
{
  grep -q -E "^\s*$|^\s*#" <<< "${1}"
}

I like it 👍🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/improvement Improve an existing feature, configuration file or the documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FR] Enhanced all-in-one ./setup.sh email list (with quotas, disk usage and aliases)

4 participants