#!/usr/bin/env bash

# Copyright 2017-Present Pivotal Software, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#  http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -eu

function checkDiskSize() {
  local vm_disk_size="${1}"

  if [ $vm_disk_size = "" ] || [ $vm_disk_size = "null" ]; then
    vm_disk_size="$( cliaas-linux get-vm-disk-size -c cliaas-config/config.yml -i $VM_IDENTIFIER) "
  fi

  echo "$vm_disk_size"
}

cliaas-linux replace-vm \
  --config cliaas-config/config.yml \
  --identifier "$VM_IDENTIFIER" \
  --disk-size-gb "$( checkDiskSize $VM_DISK_SIZE_GB )"

#!/usr/bin/env bash

# Copyright 2017-Present Pivotal Software, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#  http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -eu

function checkDiskSize() {
  local vm_disk_size="${1}"

  if [ $vm_disk_size = "" ] || [ $vm_disk_size = "null" ]; then
    vm_disk_size="$( cliaas-linux get-vm-disk-size -c cliaas-config/config.yml -i $VM_IDENTIFIER) "
  fi

  echo "$vm_disk_size"
}

diskSizeGB="$( checkDiskSize $VM_DISK_SIZE_GB )"

echo "Setting disk size of vm $VM_IDENTIFIER to $diskSizeGB"

cliaas-linux replace-vm \
  --config cliaas-config/config.yml \
  --identifier "$VM_IDENTIFIER" \
  --disk-size-gb "$diskSizeGB"

Add debugging lines for upgrade ops man disk size
Add debugging lines for upgrade ops man disk size

[#155574953]
