Skip to content

Commit

Permalink
Uses curl to fetch mlabconfig.py from the m-lab/siteinfo repo (#131)
Browse files Browse the repository at this point in the history
* Uses curl to fetch mlabconfig.py from the m-lab/siteinfo repo (mlabconfig.py moved from the operator repo to the siteinfo repo).

* Adds a TODO to replace the curl commands with native go-get commands once mlabconfig.py is rewritten in Go.

* Redirects the output of curl to a file. I forgot that curl doesn't behave like wget.

* Invokes mlabconfig.py with bash, since the file downloaded by curl doesn't have execute permissions.

* Invokes mlabconfig.py with python\!, not bash. :/

* Fixes the path to mlabconfig.py, it should be ./mlabconfig.py not .mlabconfig.py
  • Loading branch information
nkinkade authored Jul 19, 2019
1 parent 99afcbe commit 3bf34d3
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 31 deletions.
20 changes: 10 additions & 10 deletions setup_stage1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,16 @@ function generate_stage1_ipxe_scripts() {
# Create all stage1.ipxe scripts.
pushd ${build_dir}
# TODO: replace host set with metadata service.
test -d operator || git clone https://github.com/m-lab/operator
pushd operator/plsync
mkdir -p ${output_dir}
./mlabconfig.py --format=server-network-config \
--physical \
--select "${hostname_pattern}" \
--label "project=${PROJECT}" \
--template_input "${config_dir}/stage1-template.ipxe" \
--template_output "${output_dir}/stage1-{{hostname}}.ipxe"
popd
# TODO: Replace curl with a native go-get once mlabconfig is rewritten in Go.
curl --location "https://raw.githubusercontent.com/m-lab/siteinfo/master/cmd/mlabconfig.py" > \
./mlabconfig.py
mkdir -p ${output_dir}
python ./mlabconfig.py --format=server-network-config \
--physical \
--select "${hostname_pattern}" \
--label "project=${PROJECT}" \
--template_input "${config_dir}/stage1-template.ipxe" \
--template_output "${output_dir}/stage1-{{hostname}}.ipxe"
popd
}

Expand Down
21 changes: 10 additions & 11 deletions setup_stage1_isos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,16 @@ set -xuo pipefail
# Use mlabconfig to fill in the template for every machine matching the given
# HOSTNAMES pattern.
pushd ${BUILD_DIR}
test -d operator || git clone https://github.com/m-lab/operator
pushd operator/plsync
mkdir -p ${OUTPUT_DIR}/scripts
./mlabconfig.py --format=server-network-config \
--physical \
--select "${HOSTNAMES}" \
--label "project=${PROJECT}" \
--template_input "${CONFIG_DIR}/create-stage1-iso-template.sh" \
--template_output "${BUILD_DIR}/create-stage1-iso-{{hostname}}.sh"
popd
popd
# TODO: Replace curl with a native go-get once mlabconfig is rewritten in Go.
curl --location "https://raw.githubusercontent.com/m-lab/siteinfo/master/cmd/mlabconfig.py" > \
./mlabconfig.py
mkdir -p ${OUTPUT_DIR}/scripts
python ./mlabconfig.py --format=server-network-config \
--physical \
--select "${HOSTNAMES}" \
--label "project=${PROJECT}" \
--template_input "${CONFIG_DIR}/create-stage1-iso-template.sh" \
--template_output "${BUILD_DIR}/create-stage1-iso-{{hostname}}.sh"

# Check whether there are any files in the glob pattern.
if ! compgen -G ${BUILD_DIR}/create-stage1-iso-*.sh ; then
Expand Down
20 changes: 10 additions & 10 deletions setup_stage1_usbs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ set -xuo pipefail
# Use mlabconfig to fill in the template for every machine matching the given
# HOSTNAMES pattern.
pushd "${BUILD_DIR}"
test -d operator || git clone https://github.com/m-lab/operator
pushd operator/plsync
mkdir -p "${OUTPUT_DIR}/scripts"
./mlabconfig.py --format=server-network-config \
--physical \
--select "${HOSTNAMES}" \
--label "project=${PROJECT}" \
--template_input "${CONFIG_DIR}/create-stage1-usb-template.sh" \
--template_output "${BUILD_DIR}/create-stage1-usb-{{hostname}}.sh"
popd
# TODO: Replace curl with a native go-get once mlabconfig is rewritten in Go.
curl --location "https://raw.githubusercontent.com/m-lab/siteinfo/master/cmd/mlabconfig.py" > \
./mlabconfig.py
mkdir -p "${OUTPUT_DIR}/scripts"
python ./mlabconfig.py --format=server-network-config \
--physical \
--select "${HOSTNAMES}" \
--label "project=${PROJECT}" \
--template_input "${CONFIG_DIR}/create-stage1-usb-template.sh" \
--template_output "${BUILD_DIR}/create-stage1-usb-{{hostname}}.sh"
popd

# Check whether there are any files in the glob pattern.
Expand Down

0 comments on commit 3bf34d3

Please sign in to comment.