macros: Manage metadata.json file in puppet-lint jobs
Since puppet 3.x, Puppet Labs Forge accept only the metadata.json file for module description (Modulefile is now deprecated). Our puppet-lint jobs use the Modulefile to determine module name; this patch keep the « retro-compat. » with Modulefile, but fetch the module name in metadata.json file if available. Change-Id: I1738ee14706d136837b2c8fe4ffa741907291bb8
This commit is contained in:
parent
9352ce12b6
commit
47c3a04c6b
@ -90,10 +90,14 @@
|
||||
name: puppet-lint
|
||||
builders:
|
||||
- shell: |
|
||||
if [ -f Modulefile ]; then
|
||||
MODULE=$(awk '/^name/ {print $NF}' Modulefile |tr -d \"\')
|
||||
if [ -f Modulefile -o -f metadata.json ]; then
|
||||
if [ -f Modulefile ]; then
|
||||
MODULE=$(awk '/^name/ {print $NF}' Modulefile |tr -d \"\')
|
||||
elif [ -f metadata.json ]; then
|
||||
MODULE=$(python -c 'import json;print json.load(open("metadata.json"))["name"]')
|
||||
fi
|
||||
if [ -z "$MODULE" ]; then
|
||||
echo "Module name not defined in Modulefile"
|
||||
echo "Module name not defined in Modulefile or metadata.json"
|
||||
else
|
||||
mkdir -p "$MODULE"
|
||||
rsync -a --exclude="$MODULE" --exclude ".*" . "$MODULE"
|
||||
|
Loading…
x
Reference in New Issue
Block a user