Skip to content

MM-49-Feature : Delinea Importer: checkout-comment flag - #2572

Merged
hpadalkar-ks merged 3 commits into
Feature/MM-49-delinea-checkout-flagfrom
Feature/dev-MM-49-delinea-checkout-flag
Nov 26, 2026
Merged

hpadalkar-ks merged 3 commits into
Feature/MM-49-delinea-checkout-flagfrom
Feature/dev-MM-49-delinea-checkout-flag

Conversation

@hpadalkar-ks

@hpadalkar-ks hpadalkar-ks commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Description

Add support for a new --checkout-comment CLI flag on the import command when importing secrets from Delinea Secret Server (--format=thycotic). This allows users to specify a custom comment that is logged or recorded when checking out/reading secrets in a Delinea environment during import. If --checkout-comment is omitted, it falls back to the default comment (Checking out for Keeper Import).

Examples

With a custom checkout comment:

import --format=thycotic https://your-secret-server-hostname --checkout-comment="Test"

Without --checkout-comment (uses default "Checking out for Keeper Import"):

import --format=thycotic https://your-secret-server-hostname

@hpadalkar-ks
hpadalkar-ks marked this pull request as draft November 26, 2026 06:09
PLAIN = (
(PARAM_AUTO_CHECKOUT, 'false'),
(PARAM_AUTO_COMMENT, SECRET_ACCESS_COMMENT),
(PARAM_AUTO_COMMENT, ''),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

default should not be empty

self._migrate_thycotic_teams(auth, params)

checkout_comment = kwargs.get('checkout_comment')
SecretAccessMode.set_view_comment(checkout_comment)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this should be done earlier in the flow

Comment thread keepercommander/importer/commands.py Outdated
Comment on lines +160 to +161
import_parser.add_argument('--checkout-comment', dest='checkout_comment', action='store', default='Checking out for Keeper Import',
help='Thycotic/Delinea only: comment to add for secret with auto comment policy')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

move it to the end of declarations, breaking groupin of keepass

Comment thread keepercommander/importer/imp_exp.py Resolved
# Audit comment sent with every secret and secret-field read.
# Kept outside SecretAccessMode: an Enum class body would treat a plain
# assignment as another member, and member values are fixed at definition.
SECRET_ACCESS_COMMENT = 'Checking out for Keeper Import'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should be prefixed with DEFAULT_

# Kept outside SecretAccessMode: an Enum class body would treat a plain
# assignment as another member, and member values are fixed at definition.
SECRET_ACCESS_COMMENT = 'Checking out for Keeper Import'
_secret_access_comment = SECRET_ACCESS_COMMENT

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

let's name it _secret_checkout_comment

)

@classmethod
def set_view_comment(cls, comment): # type: (Optional[str]) -> None

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

rename to set_checkout_comment

Comment thread unit-tests/test_thycotic_migration.py Outdated
self.assertEqual(endpoint, f'/v1/secrets/42?{PLAIN_QUERY}')

def test_checkout_comment_replaces_the_default_on_both_modes(self):
self.addCleanup(SecretAccessMode.set_view_comment, None)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this points to flaw in the flow, if you are having to cleanup before run.
Would a dependency injection work better in code?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed, that cleanup was a sign of global state. I removed it: the checkout comment is now injected into ThycoticAuth (from --checkout-comment) and passed explicitly to with_secret_access_params. No module state, no cleanup needed in tests.

@ajaiswal-ks
ajaiswal-ks marked this pull request as ready for review November 26, 2026 07:00
@hpadalkar-ks
hpadalkar-ks merged commit a9b859e into Feature/MM-49-delinea-checkout-flag Nov 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants