Fix puppet-lint for bare puppet modules
puppet-lint expands symbolic links and use the realpath when checking for the location of manifests. This means the autoloader_layout check still fail although we tried to force the correct folder name by using a symbolic link named after the puppet module. This change brings two changes. It now copies all files to a new folder named after the puppet module. Rsync is used for the copy process. The destination folder is excluded and so are hidden folders such as .git. It also uses an alternative method to determine the module name by reading the 'name' field from the Modulefile. This allows a puppet module repository or project to be renamed without breaking puppet-lint. An example of such use case would be a rename of puppet-quantum to puppet-neutron. If the Modulefile is not found or the name cannot be determined, the puppet-lint builder falls back to its default behavior which consists of running puppet-lint in the root of the workspace. Change-Id: I6158ab3b32499820b7d09db7b31d4226650af8ae
This commit is contained in:
parent
3f18a111af
commit
5c1dacbd81
@ -66,10 +66,16 @@
|
||||
name: puppet-lint
|
||||
builders:
|
||||
- shell: |
|
||||
test -d modules || {{
|
||||
ln -s . {project}
|
||||
cd {project}
|
||||
}}
|
||||
if [ -f Modulefile ]; then
|
||||
MODULE=$(awk '/^name/ {print $NF}' Modulefile |tr -d \"\')
|
||||
if [ -z "$MODULE" ]; then
|
||||
echo "Module name not defined in Modulefile"
|
||||
else
|
||||
mkdir -p "$MODULE"
|
||||
rsync -a --exclude="$MODULE" --exclude ".*" . "$MODULE"
|
||||
cd "$MODULE"
|
||||
fi
|
||||
fi
|
||||
rake lint
|
||||
|
||||
- builder:
|
||||
|
@ -20,8 +20,7 @@
|
||||
|
||||
builders:
|
||||
- gerrit-git-prep
|
||||
- puppet-lint:
|
||||
project: '{name}'
|
||||
- puppet-lint
|
||||
|
||||
publishers:
|
||||
- console-log
|
||||
|
Loading…
Reference in New Issue
Block a user