Skip to content
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

win_lineinfile crashes when both insertafter and insertbefore is given #220

Closed
phoenikz opened this issue Apr 1, 2021 · 0 comments · Fixed by #221
Closed

win_lineinfile crashes when both insertafter and insertbefore is given #220

phoenikz opened this issue Apr 1, 2021 · 0 comments · Fixed by #221

Comments

@phoenikz
Copy link
Contributor

phoenikz commented Apr 1, 2021

SUMMARY

If supplying both insertafter and insertbefore the module crashes instead of the intended warning

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_lineinfile

STEPS TO REPRODUCE

See summary

EXPECTED RESULTS

Warning about ignored parameter

ACTUAL RESULTS

The full traceback is:

You cannot call a method on a null-valued expression.
At line:102 char:9
+     if (-not $obj.ContainsKey("warnings")) {
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : InvokeMethodOnNull

ScriptStackTrace:
at Add-Warning, <No file>: line 102
at <ScriptBlock>, <No file>: line 421
fatal: [10.73.84.77]: FAILED! => {
    "changed": false,
    "msg": "Unhandled exception while executing module: You cannot call a method on a null-valued expression."
}
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 a pull request may close this issue.

1 participant