Skip to content

Commit

Permalink
hack: support use of a config-local.sh for dev specific defaults
Browse files Browse the repository at this point in the history
The settings in config.sh may be fine when using a pre-defined
vagrant VM for builds & tests, but developers with non-vagrant
based environments may need customizations. Modifying config.sh
directly is not satisfactory since you don't want local env
setup to trigger dirty files in the git index. Thus allow use
of a hack/config-local.sh script that is non-version controlled.

Signed-off-by: Daniel P. Berrange <[email protected]>
  • Loading branch information
berrange committed Jul 13, 2017
1 parent 1239779 commit 983679b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ cluster/vagrant/.kubeconfig
cluster/vagrant/.kubectl
cluster/.console.vv
build-tools/desc/desc
hack/config-local.sh
tags
6 changes: 5 additions & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ $cache_docker = ENV['VAGRANT_CACHE_DOCKER'] == 'true'
$cache_rpm = ENV['VAGRANT_CACHE_RPM'] == 'true'
$nodes = (ENV['VAGRANT_NUM_NODES'] || 0).to_i

$config = Hash[*File.read('hack/config.sh').split(/=|\n/)]
$config = Hash[*File.read('hack/config-default.sh').split(/=|\n/)]
if File.file?('hack/config-local.sh') then
$localConfig = Hash[*File.read('hack/config-local.sh').split(/=|\n/)]
$config = $config.merge($localConfig)
end

$master_ip = $config["master_ip"]
$network_provider = $config["network_provider"]
Expand Down
8 changes: 8 additions & 0 deletions hack/config-default.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
binaries="cmd/virt-controller cmd/virt-launcher cmd/virt-handler cmd/virt-api cmd/virtctl cmd/virt-manifest"
docker_images="$binaries images/haproxy images/iscsi-demo-target-tgtd images/vm-killer images/libvirt-kubevirt images/spice-proxy cmd/virt-migrator"
docker_prefix=kubevirt
docker_tag=${DOCKER_TAG:-latest}
manifest_templates="`ls manifests/*.in`"
master_ip=192.168.200.2
master_port=8184
network_provider=weave
19 changes: 11 additions & 8 deletions hack/config.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
binaries="cmd/virt-controller cmd/virt-launcher cmd/virt-handler cmd/virt-api cmd/virtctl cmd/virt-manifest"
docker_images="$binaries images/haproxy images/iscsi-demo-target-tgtd images/vm-killer images/libvirt-kubevirt images/spice-proxy cmd/virt-migrator"
docker_prefix=kubevirt
docker_tag=${DOCKER_TAG:-latest}
manifest_templates="`ls manifests/*.in`"
master_ip=192.168.200.2
master_port=8184
network_provider=weave
unset binaries docker_images docker_prefix docker_tag manifest_templates \
master_ip master_port network_provider

source hack/config-default.sh

# Let devs override any default variables, to avoid needing
# to change the version controlled config-default.sh file
test -f "hack/config-local.sh" && source hack/config-local.sh

export binaries docker_images docker_prefix docker_tag manifest_templates \
master_ip master_port network_provider

0 comments on commit 983679b

Please sign in to comment.