github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/acceptancetests/repository/charms/jenkins-slave/hooks/slave-relation-joined (about)

     1  #!/bin/bash
     2  
     3  set -e
     4  
     5  # Set the slave hostname to match the juju unit
     6  # in the jenkins master instance
     7  slavehost=$(echo ${JUJU_UNIT_NAME} | sed s,/,-,)
     8  noexecutors=$(cat /proc/cpuinfo | grep processor | wc -l)
     9  config_labels=$(config-get labels)
    10  labels=$(uname -p)
    11  
    12  if [[ -n "$config_labels" ]]; then
    13      labels=$config_labels
    14  fi
    15  
    16  # Set all relations
    17  relation-set executors=$noexecutors
    18  relation-set labels="$labels"
    19  relation-set slavehost=$slavehost
    20  relation-set slaveaddress=`unit-get private-address`