Skip to content

Distributor setting is not respected when versioned feature flag is in effect #1284

@ferki

Description

@ferki

When a versioned feature flag is enabled, and a distributor is set, like:

use Rex -feature => ['1.4'];

set_distributor 'Parallel_ForkManager';

then the distributor setting does not seem to have any effect (in other words, it always loads Rex::TaskList::Base), as shown by the debug output:

$ rex -d uptime
[2020-04-07 20:01:44] DEBUG - This is Rex version: 1.9.0
[...]
[2020-04-07 20:01:44] DEBUG - activating featureset >= 0.51
[2020-04-07 20:01:44] DEBUG - activating featureset >= 0.40
[2020-04-07 20:01:44] DEBUG - activating featureset >= 0.35
[2020-04-07 20:01:44] DEBUG - activating featureset >= 0.31
[2020-04-07 20:01:44] DEBUG - Creating new distribution class of type: Base
[2020-04-07 20:01:44] DEBUG - new distribution class of type Rex::TaskList::Base created.
[2020-04-07 20:01:44] DEBUG - Returning existing distribution class of type: Rex::TaskList::Base
[2020-04-07 20:01:44] DEBUG - Creating task: uptime
[...]

On one hand this is because the Rex::TaskList creation is cached, so only one object is created (this is probably good), and on the other hand it's because activating the 0.31 feature set simply calls Rex::TaskList->create()->set_default_auth(0); which creates the object before any configuration options are considered.

I'll propose a fix in a PR soon, which converts the default_auth setting into a first-class configuration option, so 0.31 can behave exactly like other feature flags (that is, simply setting values for configuration variables, instead of instantiating objects early).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions