Azure / nxtools

Azure Automanage Machine Configuration Linux DSC resources
Other
13 stars 11 forks source link

Fix nxUser FullName and Description bug #23

Closed gurrajatwal closed 1 year ago

gurrajatwal commented 1 year ago

Pull Request (PR) description

Fixed bugs with nxUser where if FullName and Description fields are provided in the mof file of a custom package, Start-GuestConfigurationPackageRemediation fails because the useradd command that is created is invalid.

Command before fix: useradd -d "/home/test" -c test user,,,,Some description, -U

There are two problems with this command.

  1. The COMMENT string, after the -c flag, needs to be in quotes. Otherwise, we see an error: "Missing expression after ',' in pipeline element."
  2. There is an extra comma after the Description because when parsing /etc/passwd, nxLocalUser is expecting 5 comma-separated GECOS fields, not 6.

Command after fix: useradd -d "/home/test" -c "test user,,,,Some description" -U

This Pull Request (PR) fixes the following issues

None

Task list