<commit_before>#!/bin/bash -eu

function main() {
  export CURR_DIR=$(pwd)
  export OPSMGR_VERSION=$(cat ./pivnet-opsmgr/metadata.json | jq '.Release.Version' | sed -e 's/^"//' -e 's/"$//')

  export OPSMAN_NAME=OpsManager-${OPSMGR_VERSION}-$(date +"%Y%m%d%H%S")

  echo '
  {
    "DiskProvisioning":"thin",
    "IPAllocationPolicy":"dhcpPolicy",
    "IPProtocol":"IPv4",
    "NetworkMapping": [{
      "Name":"Network 1",
      "Network":"${OPSMAN_NETWORK}"
    }],
    "PropertyMapping":[
      {"Key":"ip0","Value":"${OPSMAN_IP}"},
      {"Key":"netmask0","Value":"${NETMASK}"},
      {"Key":"gateway","Value":"${GATEWAY}"},
      {"Key":"DNS","Value":"${DNS}"},
      {"Key":"ntp_servers","Value":"${NTP}"},
      {"Key":"admin_password","Value":"${OPSMAN_ADMIN_PASSWORD}"}
    ],
    "PowerOn":false,
    "InjectOvfEnv":false,
    "WaitForIP":false
  }' > ./opsman_settings.json

  cat ./opsman_settings.json

  echo "Importing OVA of new OpsMgr VM..."
  echo "Running govc import.ova -options=opsman_settings.json -name=${OPSMAN_NAME} -k=true -u=${GOVC_URL} -ds=${GOVC_DATASTORE} -dc=${GOVC_DATACENTER} -pool=${GOVC_RESOURCE_POOL} -folder=/${GOVC_DATACENTER}/${OPSMAN_VM_FOLDER} ${CURR_DIR}/pivnet-opsmgr/pcf-vsphere-1.9.2.ova"
  govc import.ova -options=opsman_settings.json -name=${OPSMAN_NAME} -k=true -u=${GOVC_URL} -ds=${GOVC_DATASTORE} -dc=${GOVC_DATACENTER} -pool=${GOVC_RESOURCE_POOL} -folder=/${GOVC_DATACENTER}/${OPSMAN_VM_FOLDER} ${CURR_DIR}/pivnet-opsmgr/pcf-vsphere-1.9.2.ova

  echo "Setting CPUs on new OpsMgr VM..."
  govc vm.change -c=2 -k=true -vm /${GOVC_DATACENTER}/vm/${OPSMAN_VM_FOLDER}/${OPSMAN_NAME}

  echo "Shutting down OLD OpsMgr VM..."
  govc vm.power -off=true -vm.ip=${OPSMAN_IP}

  echo "Starting OpsMgr VM..."<commit_msg>[#137620763] vm network name<commit_after>#!/bin/bash -eu

function main() {
  export CURR_DIR=$(pwd)
  export OPSMGR_VERSION=$(cat ./pivnet-opsmgr/metadata.json | jq '.Release.Version' | sed -e 's/^"//' -e 's/"$//')

  export OPSMAN_NAME=OpsManager-${OPSMGR_VERSION}-$(date +"%Y%m%d%H%S")

  echo '
  {
    "DiskProvisioning":"thin",
    "IPAllocationPolicy":"dhcpPolicy",
    "IPProtocol":"IPv4",
    "NetworkMapping": [{
      "Name":"VM Network",
      "Network":"${OPSMAN_NETWORK}"
    }],
    "PropertyMapping":[
      {"Key":"ip0","Value":"${OPSMAN_IP}"},
      {"Key":"netmask0","Value":"${NETMASK}"},
      {"Key":"gateway","Value":"${GATEWAY}"},
      {"Key":"DNS","Value":"${DNS}"},
      {"Key":"ntp_servers","Value":"${NTP}"},
      {"Key":"admin_password","Value":"${OP<PASSWORD>}"}
    ],
    "PowerOn":false,
    "InjectOvfEnv":false,
    "WaitForIP":false
  }' > ./opsman_settings.json

  cat ./opsman_settings.json

  echo "Importing OVA of new OpsMgr VM..."
  echo "Running govc import.ova -options=opsman_settings.json -name=${OPSMAN_NAME} -k=true -u=${GOVC_URL} -ds=${GOVC_DATASTORE} -dc=${GOVC_DATACENTER} -pool=${GOVC_RESOURCE_POOL} -folder=/${GOVC_DATACENTER}/${OPSMAN_VM_FOLDER} ${CURR_DIR}/pivnet-opsmgr/pcf-vsphere-1.9.2.ova"
  govc import.ova -options=opsman_settings.json -name=${OPSMAN_NAME} -k=true -u=${GOVC_URL} -ds=${GOVC_DATASTORE} -dc=${GOVC_DATACENTER} -pool=${GOVC_RESOURCE_POOL} -folder=/${GOVC_DATACENTER}/${OPSMAN_VM_FOLDER} ${CURR_DIR}/pivnet-opsmgr/pcf-vsphere-1.9.2.ova

  echo "Setting CPUs on new OpsMgr VM..."
  govc vm.change -c=2 -k=true -vm /${GOVC_DATACENTER}/vm/${OPSMAN_VM_FOLDER}/${OPSMAN_NAME}

  echo "Shutting down OLD OpsMgr VM..."
  govc vm.power -off=true -vm.ip=${OPSMAN_IP}

  echo "Starting OpsMgr VM..."
{'fraction_non_alphanumeric': 0.22030053870144597, 'fraction_numerical': 0.008505812305075135, 'mean_word_length': 4.427692307692308, 'pattern_counts': {'":': 44, '<': 4, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3591757', 'n_tokens_mistral': 1450, 'n_tokens_neox': 1458, 'n_words': 198}