Skip to content

Commit 4772b03

Browse files
committed
chore: drop the re-init ids reset, plugins are initialized once
1 parent e010dd8 commit 4772b03

2 files changed

Lines changed: 2 additions & 6 deletions

File tree

plugin.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,7 @@ func (p *Plugin) Init(cfg Configurer, log NamedLogger) error {
8888

8989
p.log = log.NamedLogger(PluginName)
9090

91-
// resolve the configured run-as user's uid/gid once; reset first so a
92-
// re-Init without a configured user does not keep stale values
93-
p.ids = nil
91+
// resolve the configured run-as user's uid/gid once
9492
if p.cfg.User != "" {
9593
// process.ExecuteFromUser is a no-op on Windows, and Windows uids (SIDs)
9694
// are not numeric — reject the option explicitly instead of failing on Atoi.

plugin_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,6 @@ func TestInitUnknownUser(t *testing.T) {
132132
preparedEnvs: make([]string, 0),
133133
cfg: &Config{},
134134
log: log,
135-
// pre-populate so the assertions below prove Init resets the stale ids
136-
ids: &ids{uid: 7, gid: 7},
137135
}
138136

139137
v := viper.New()
@@ -145,7 +143,7 @@ func TestInitUnknownUser(t *testing.T) {
145143

146144
err = p.Init(cfg, NewTestLogger(log))
147145
require.Error(t, err)
148-
// the failed resolution must reset the stale ids, reading as 0/0
146+
// the failed resolution must leave the ids unset, reading as 0/0
149147
require.Equal(t, 0, p.UID())
150148
require.Equal(t, 0, p.GID())
151149
}

0 commit comments

Comments
 (0)