NetworkingDsc icon indicating copy to clipboard operation
NetworkingDsc copied to clipboard

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

Open Francois-Rousseau opened this issue 4 years ago • 2 comments

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

Francois-Rousseau avatar Feb 25 '20 17:02 Francois-Rousseau

Taking a look at this, might require a refactor on the resource to implement properly since there's some duplicated code that would make this challenging as is.

MKletz avatar Sep 17 '20 01:09 MKletz

Happy for anyone to refactor this one @MKletz - does need a bit of attention to clean it up.

PlagueHO avatar Dec 01 '20 07:12 PlagueHO