To install msodbcsql that comes with mssql-tools that are needed to use the PHP Microsoft SQL Driver for Linux the following command is needed
sudo ACCEPT_EULA=Y apt-get install mssql-tools
However when installing this with Puppet, this fails, the puppet code currently used
package { 'mssql-tools' : ensure => latest, }
But this returns an error:
ERROR: The EULA was not accepted. Installation aborted.
What would be needed so Puppet can successfully install this package. I already tried setting a environment variable before calling the package command.
Exec { environment => [ "ACCEPT_EULA=Y" ] }
Microsoft's installation instructions are here:
https://blogs.msdn.microsoft.com/sqlnativeclient/2017/02/04/odbc-driver-13-1-for-linux-released/
And this is the driverpage:
https://www.microsoft.com/en-us/sql-server/developer-get-started/php/ubuntu/
It appears that this is a feature that was requested; Run the package entity with an environment value.
But since there is a feature freeze this will not be implemented in puppet 4.x (https://projects.puppetlabs.com/issues/6400)
The workaround is to not use the package entity but the exec entity:
exec { "/usr/bin/apt-get -yq install msodbcsql":
environment => "ACCEPT_EULA=Y",
unless => "/usr/bin/dpkg -l msodbcsql | tail -1 | grep ^ii",
}
Where unless is used to make it idempotent to not run if the package is already installed.
Disadvantage of this method is that this only works when using apt-get if you would want this to work on other systems as well you should provide an $osfamily
with if statement to use the correct package manager.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With