X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=extraconfig%2Fall_nodes%2Fswap-partition.j2.yaml;h=b6fef79fd0bd8be5c4a4ba107b5ac9a807a83cd8;hb=8022b520d365055b9ad9be1f57b52fed556e1d45;hp=014a96a10ba28d69b1008c88cb30ce3f810d7563;hpb=109497552b557f8744d0033947ad43dfc8eccb70;p=apex-tripleo-heat-templates.git diff --git a/extraconfig/all_nodes/swap-partition.j2.yaml b/extraconfig/all_nodes/swap-partition.j2.yaml index 014a96a1..b6fef79f 100644 --- a/extraconfig/all_nodes/swap-partition.j2.yaml +++ b/extraconfig/all_nodes/swap-partition.j2.yaml @@ -1,11 +1,7 @@ -heat_template_version: 2014-10-16 +heat_template_version: ocata -description: > - Extra config to add swap space to nodes. +description: Template file to add a swap partition to a node. -# Parameters passed from the parent template - note if you maintain -# out-of-tree templates they may require additional parameters if the -# in-tree templates add a new role. parameters: servers: type: json @@ -14,9 +10,7 @@ parameters: description: Swap partition label default: 'swap1' - resources: - SwapConfig: type: OS::Heat::SoftwareConfig properties: @@ -25,8 +19,13 @@ resources: #!/bin/bash set -eux swap_partition=$(realpath /dev/disk/by-label/$swap_partition_label) - swapon $swap_partition - echo "$swap_partition swap swap defaults 0 0" >> /etc/fstab + if [ -f "$swap_partition" ]; then + swapon $swap_partition + echo "$swap_partition swap swap defaults 0 0" >> /etc/fstab + else + echo "$swap_partition needs to be a valid path" + echo "Check that $swap_partition_label is a valid partition label" + fi inputs: - name: swap_partition_label description: Swap partition label @@ -37,7 +36,7 @@ resources: type: OS::Heat::SoftwareDeploymentGroup properties: config: {get_resource: SwapConfig} - servers: {get_param: servers, {{role.name}}} + servers: {get_param: [servers, {{role.name}}]} input_values: swap_partition_label: {get_param: swap_partition_label} actions: ["CREATE"]