-
Notifications
You must be signed in to change notification settings - Fork 31
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
Feature/user expiry #581
Feature/user expiry #581
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ package user | |
import ( | ||
"fmt" | ||
"math" | ||
"time" | ||
|
||
"github.com/asteris-llc/converge/load/registry" | ||
"github.com/asteris-llc/converge/resource" | ||
|
@@ -72,6 +73,12 @@ type Preparer struct { | |
// HomeDir must also be indicated if MoveDir is set to true. | ||
MoveDir bool `hcl:"move_dir"` | ||
|
||
// Expiry is the date on which the user account will be disabled. The date is | ||
// specified in the format YYYY-MM-DD. If not specified, the default expiry | ||
// date specified by the EXPIRE variable in /ect/default/useradd, or an empty | ||
// string (no expiry) will be used by default. | ||
Expiry time.Time `hcl:"expiry"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I only set the expiry if it is specified in the hcl. There are checks in user.go (DiffAdd and DiffMod) for this. |
||
|
||
// State is whether the user should be present. | ||
// The default value is present. | ||
State State `hcl:"state" valid_values:"present,absent"` | ||
|
@@ -111,6 +118,7 @@ func (p *Preparer) Prepare(ctx context.Context, render resource.Renderer) (resou | |
usr.HomeDir = p.HomeDir | ||
usr.MoveDir = p.MoveDir | ||
usr.State = p.State | ||
usr.Expiry = p.Expiry | ||
|
||
if p.UID != nil { | ||
usr.UID = fmt.Sprintf("%v", *p.UID) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo. Should be
/etc/default/useradd