I've been finding various different regexes being used for
extracting/matching ASF availids.

So it struck me it might be useful to define the RE string once in the
asf/whimsy library.

e.g. assuming the most restrictive useradd [1] rule:

AVAILID_RE = '[a-z_][a-z0-9_-]*[$]?'

However this is too general; we don't want to allow '$'  (not
currently used in any ids) and care needs to be taken with '-' because
of INFRA-11485 / INFRA-7390.single

Maybe we need two REs:
1) matching all possible existing ids; some of these contain hyphens;
some service accounts start with _

2) a stricter version for adding new accounts - e.g. we don't want to
allow hyphen because of INFRA-11485 and we probably don't want to
allow _ either

Possibly also define some methods if there seem to some common usages
once the constants are in place.

It would certainly be useful to have a single shared uidValid? method.

Thoughts?

[1] http://www.unix.com/man-page/linux/8/useradd/

Reply via email to