Skip to content

CFE-4074, ENT-14368: Now supports "file" and "string-multiline" as list subtypes in module input - #339

Open
larsewi wants to merge 2 commits into
cfengine:masterfrom
larsewi:file-input-in-list
Open

CFE-4074, ENT-14368: Now supports "file" and "string-multiline" as list subtypes in module input#339
larsewi wants to merge 2 commits into
cfengine:masterfrom
larsewi:file-input-in-list

Conversation

@larsewi

@larsewi larsewi commented Sep 7, 2026

Copy link
Copy Markdown
Contributor
  • Allow "file" as a list subtype in module input
  • Allow "string-multiline" as a list subtype in module input

Sorry @SimonThalvorsen that I did not catch this while reviewing your PRs for CFE-4074 and ENT-14368. This is how I think it should work. When you want multiple of something, it must be in a "list" input type. We should not re-implement "while" for each type we want multiples of. The "list" input type also allows for a series of questions to be asked per loop. And I'll need this in ENT-14365.

@aleksandrychev this may break the work you've done on MP and the module you created using the "file" type.

larsewi and others added 2 commits September 7, 2026 14:10
Removed "with" attibute from "file" input type and added support for
collecting "file" as a subtype of "list" input.

Why? Because definition in the added 062_input_file_in_list_with_keys.sh
could not be expressed at all before. I.e., list of objects.

Ticket: CFE-4074
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
A "list" input can now collect several blocks of text, the same way it
collects strings and files.

Ticket: ENT-14368
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.48485% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 67.70%. Comparing base (41de10d) to head (884c435).

Files with missing lines Patch % Lines
cfbs/cfbs_config.py 95.23% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #339      +/-   ##
==========================================
+ Coverage   66.73%   67.70%   +0.97%     
==========================================
  Files          23       24       +1     
  Lines        4623     4638      +15     
==========================================
+ Hits         3085     3140      +55     
+ Misses       1538     1498      -40     
Files with missing lines Coverage Δ
cfbs/build.py 70.57% <100.00%> (-0.30%) ⬇️
cfbs/commands.py 53.86% <100.00%> (-0.21%) ⬇️
cfbs/module_input.py 100.00% <100.00%> (ø)
cfbs/validate.py 81.78% <100.00%> (+0.70%) ⬆️
cfbs/cfbs_config.py 87.43% <95.23%> (+6.13%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread cfbs/validate.py
% filetype,
)
for part in filetypes:
if type(part) is not str or not part.strip() or not part.startswith("."):

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.

".txt " would pass here, and get stuck in the loop with response.endswith(filetype) check later

@SimonThalvorsen SimonThalvorsen left a 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.

Agree with the changes! Nice that you caught this early, makes more sense to use the list-type rather that treating the file-type as a potential list

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants