I'm running Puppet 2.7.14 on RHEL 6.2 (both master and nodes have this configuration).
For the life of me, I can't figure out why I can't make custom mount points work.
If for example, I edit /etc/puppet/fileserver.conf to include the following:
[foo]
path /etc/puppet/files/foo
allow *
And put the file bar.txt in /etc/puppet/files/foo/bar.txt
Then I would expect resources like the following to resolve with no trouble:
file { "bar.txt":
ensure => present,
path => "/var/foo/bar.txt",
source => "puppet:///foo/bar.txt",
}
But this doesn't work! I consistently see error messages like the following:
... Could not evaluate: Could not retrieve information from environment production source(s) puppet:///foo/bar.txt ...
According to all documentation I have read, I have done this correctly, but I just can't get it to work.
Any thoughts?
Seems there's a "gotcha" at work here. A tabstop before the path or allow attribute is not allowed. Very surprising.
Related
Basic Info :
Puppet Version: 2.8.1
OS Name/Version: RedHat 7
We are trying to run the below puppet resource but we are getting whitespace error, Please find the same.
mount { "/SERVER/New York_share":
atboot => true,
ensure => mounted,
device => "//MOUNTSERVER/New York_share",
fstype => "cifs",
options => "credentials=/tmp/id,uid=oracle,gid=oinstall,iocharset=utf8,file_mode=0644,dir_mode=0775,_netdev,soft", }
Error:
Failed to apply catalog: Parameter name failed on Mount[/SERVER/New
York_share]: name must not contain whitespace: /SERVER/New York_share
at
/etc/puppetlabs/code/environments/master/site/profile/manifests/ob.pp:132
Anybody could suggest us. Please respond.
As the error message suggests, Puppet will not accept spaces in the mount point. It looks like you will need to rename your mount point so that it doesn't have spaces in it.
The behaviour goes all the way back to Puppet Bug #6409, where it was found that a mount point with spaces would break fstab, because fstab also doesn't support spaces in the mount point either.
Arguably, Puppet's behaviour is incorrect, and instead of erroring out, Puppet should write a string \040 in fstab like this article says. It's probably not hard to fix this behaviour, if someone feels like raising a pull request.
This is an new feature and it was apparently an intentional decision many years ago. We can look into supporting whitespace in paths here,
For More Info
I've been following this Suave tutorial:
https://legacy.gitbook.com/book/theimowski/suave-music-store/details
And in general this looks good. However, I was trying to make it work with Linux and for some reason I was unable to compile it with code when TargetFramework was set to "net461" (Target Framework not found), so I tried changing it to "netcoreapp2.0". It compiled, but I hit a problem later on:
https://theimowski.gitbooks.io/suave-music-store/content/en/css.html
At the end it says to add a WebPart:
pathRegex "(.*)\.(css|png)" >=> Files.browseHome
which fails for me. All compiles, but I get
This page isn’t working
localhost didn’t send any data.
I took a look at Suave's source code and it turned out that "Files.browseHome" searches for a file under "ctx.runtime.homeDirectory".
I noticed that this is set on my machine to:
/home/<my_user_name>/.nuget/packages/suave/2.2.1/lib/netstandard1.6
and obviously, that's not my project directory, so no wonder it couldn't find the file.
My question here is: what shall I do in order to make my Suave app handle my css/png files correctly using Files.browseHome ?
EDIT:
Just found out that replacing the WebPart with:
pathRegex "(.*)\.(css|png)" >=> Files.browse "/home/<my_username>/<path_to_my_project>/bin/Debug/netcoreapp2.0/"
works fine, but it looks ugly. Any idea how to make it better ? Basically I don't want to be forced to hardcode the absolute path anywhere.
I think the answer is to be found in https://suave.io/files.html, which suggests creating a config as follows:
let config =
{ defaultConfig with homeFolder = Some (Path.GetFullPath "./public") }
The path returned by Path.GetFullPath will depend on the current working directory that your app sees when it's started (which will, in turn, depend on how you start the app: from the command line, from a systemd unit file, etc.) There are too many possible variables here for me to be able to give you exact instructions, but if your startup method can cd into an appropriate folder before starting your Suave server, then that should solve your problem.
If you run into difficulties with getting the current working directory set correctly, then you could just hardcode the full path in the config:
let config =
{ defaultConfig with homeFolder = Some "/home/<your_username>/<path_to_your_project>/bin/Debug/netcoreapp2.0/" }
But that's kind of ugly, and not really portable (you'd have to modify that path again once you deploy the app). So I'd recommend the approach of making sure your start script does a cd to the right location, then using Path.GetFullPath with a relative path. Alternately, you could have a config file that gets read in at app startup where you specify the home path, or pass it in as an environment variable... All kinds of possibilities. Just make sure that your code can be handed some information on startup that specifies the correct "home" folder, and then put that in your Suave config as I've shown, and that should solve it.
After I uploaded my Typo3-Website onto a linux server and tryed to call the homepage, I get the error: "Could not load layout file. Tried following paths: "/Main.html", "/Main" "
I checked the correct spelling (uppercase) of my layout file: It seems to be correct and in the right place. Any ideas?
Thanks a lot. I have checked the file paths and noticed I had to delete the two slashes after the equal signs.
This works on a windows platform:
partialRootPath = /fileadmin/Private/Partials/
layoutRootPath = /fileadmin/Private/Layouts
But on a linux server it has to look this way:
partialRootPath = fileadmin/Private/Partials/
layoutRootPath = fileadmin/Private/Layouts
You seem to be using TYPO3 before 7 and the StandaloneView. In this case, identify in your code where you use this view and check the calls to setTemplatePathAndFilename or the templateRootPath. You are probably having an issue with the root path being set to something that does not exist.
This might be a situation of incompatible cAsiNg of the directory name. This is especially possible if you are testing locally on MacOS (case insensitive) and then uploading to Linux (case sensitive).
If this does not help, please provide us with more information about your scenario (code, settings, environment where it works, etc).
When referring to a file resource on the puppet master, does it have to reside under the modulepath? The docs here seem to indicate it.
The file I'm using was put under the profiles folder instead. I'm trying to refer to it like this:
source => puppet:///profiles/a_subfolder/myfile
(The physical path on the box is /profiles/files/a_subfolder/myfile)
I'm not having any luck so far and wanted to confirm that I can point a file resource somewhere besides the modulepath, and that my URI is correct.
Also, if my subfolder doesn't exist yet on the puppet agent, do I need to set some extra flags to both create the folder path and put the file in place? Here's what I have now:
ensure => 'present',
source => 'puppet:///profiles/a_subfolder/myfile',
mode => '0755',
owner => 'specialuser'
I found the following solution worked..
source => 'puppet:///modules/profiles/',
in your case -
source => 'puppet:///modules/profiles/a_subfolder/myfile',
Hope this helps
I'm new to puppet but as far as I understood you need to set up a puppet file server if you want to use puppet:// URIs.
https://docs.puppetlabs.com/guides/file_serving.html
If you want the file to get from your puppet master, please do the following:
1) create the folder on you puppet master. Let's take it as /opt/puppet_dev
2) edit /etc/puppet/fileserver.conf and add:
[puppet_dev]
path /opt/puppet_dev
allow *
3) In your manifest write:
file { '/opt/on_my_node/slave_path':
source => "puppet:///puppet_dev/my_folder_I_want_to_move",
ensure => present,
}
4) restart puppetmaster service ( you change fileserver, I recommend to restart) and run the agent.
Note: you can control the recurse and the recursive limit with file. Always use this when writing puppet: https://docs.puppetlabs.com/references/latest/type.html
Hopes this is what your were looking for :)
I know puppet modules always have a files directory and I know where it's supposed to be and I have used the source => syntax effectively from my own, handwritten modules but now I need to learn how to deploy files using Hiera.
I'm starting with the saz-sudo module and I've read the docs but I can't see anything about where to put the sudoers file; the one I want to distribute.
I'm not sure whether I need to set up a site-wide files dir in /etc/puppetlabs/puppet and then make subdirs in there for every module or what. And does Hiera know to look in /etc/puppetlabs/puppet/files/sudo if I say, source => "puppet:///files/etc/sudoers" ? Do I need to add a pathname in /etc/hiera.yaml? Add a line - files ?
Thanks for any clues.
My cursory view of the puppet module, given their example of using hiera:
sudo::configs:
'web':
'source' : 'puppet:///files/etc/sudoers.d/web'
'admins':
'content' : "%admins ALL=(ALL) NOPASSWD: ALL"
'priority' : 10
'joe':
'priority' : 60
'source' : 'puppet:///files/etc/sudoers.d/users/joe'
Suggest it assumes you have a "files" puppet module. So under you puppet modules section:
mkdir -p files/files/etc/sudoers.d/
Drop your files in there.
Explanation:
The url 'puppet:///files/etc/sudoers.d/users/joe' is broken down thus:
puppet: protocol
///: Three slashes indicate the source of the file is in a module.
files: name of the module
etc/sudoers.d/users/joe: full path to the file within the module's "files" directory.
You don't.
The idea of a module (Hiera backed or not) is to lift the need to manage the whole sudoers file from you. Instead, you can manage each single entry in the sudoers file.
I recommend reviewing the documentation carefully. You should definitely not have a file { "/etc/sudoers": } resource in your manifest.
Hiera doesn't have to do anything with Files.
Hiera is like a Variables Database, and servers you based on the hierarchy you have.
the files inside puppet, are usually accessed in methods like source => but also these files are using some basic structure.
In most cases when you call an file or template.
A template can serve your needs to automatically build an sudoers based on that.
There are also modules that supports modifying sudoers too.
It is up to you what to do.
In this case, saz stores the location of the file in hiera, but the real location can be a file inside your puppet (like a module file or something similar).
Which is completely unrelated.
Read about puppet file server
If you have questions, just ask.
V