dsccommunity / dsccommunity/NetworkingDsc

HostsFile : Add possibility to put a comment on each line added

Open
#445 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
PowerShell
Stars
235
Forks
93
PR merge metrics
No merged PRs in 30d

Description

Details of the scenario you tried and the problem that is occurring

When using the resource to add a entry in the HostsFile, there is no possibility to add a comment at the end of line, as we usually do.

The purpose is to leave a trace about why the entry is there.

Verbose logs showing the problem
Suggested solution to the issue

Add a parameter (string) that can be added at end of line when adding an entry.

The DSC configuration that is used to reproduce the issue (as detailed as possible)
- name: Fichier hosts pour installation
  win_dsc:
    resource_name: HostsFile
    HostName: '{{item.Name}}'
    Ensure: Present
    IPAddress: '{{item.IP}}' 
  with_items:
    - '{{ListeHostsPourInstallWAP}}'
The operating system the target node is running
Version and build of PowerShell the target node is running
Version of the DSC module that was used ('dev' if using current dev branch)

6.1.0.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the HostsFile DSC resource and inspect how it creates or updates each hosts-file entry. Implement the requested string parameter for an end-of-line comment, then verify that entries are written with the comment while existing entries remain handled correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
networking
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.