Unable to install pip packages using dsc

Hello Team,

I am using powershell dsc to install python and databricks pip package.

I am successfully able to install the python, set variables. However, when I am running pip install package name, I am getting errors.

I tried this

xScript Installdbcli
{
GetScript = {

#pass
}

TestScript = {

return $false

}

SetScript = {$output= Invoke-Command -ScriptBlock {“start powershell.exe /k ““C:\Program Files\Python38\Scripts”” pip install databricks-cli” }
Write-Host $output}
}

 

Command gets successful but it did not install the package, could anyone know why this is happening.

I tried pip install databricks-cli only, it says pip is not recognized but environment variables are already set in the same configuration and if I try to run this command manually on the node, it works fine.

 

Please help!

If the env var are set in the same config, they won’t be there for the script resources unless there’s a reboot in between.

You can think the DSC LCM as a thread Master, creating a Child thread for each resources, in sequence.

Child thread inherits env var from their parents.

So if a child sets an env var, it won’t go up to its parent, so the next child won’t pick it up either.

 

Thanks @Gaelcolas, so if I put reboot in between, will it work?

I am mean I am new to dsc, if the machine is rebooted will configuration resume from where it left?

Thanks,

Akshay