blablacar / dgr

Container build and runtime tool
Apache License 2.0
249 stars 21 forks source link

template problem #191

Closed zeysh closed 8 years ago

zeysh commented 8 years ago

Hi,

Each time I want to use a template with {{ .rootfs }}, the value returned is ""

Ex: with gentoo-stage4 the variable {{.rootfs}} for ROOT in /etc/portage/make.conf

─(± $sudo dgr try                                                                                                                                                     
08:35:51 INFO        dgr/bin-dgr/aci-build.go:49  Building                                     aci=blablacar.github.io/dgr/aci-gentoo-stage4
image: using image from file /tmp/eVDmUStMxtMDBAmjecyA.aci
08:35:52 INFO        dgr/bin-dgr/aci-build.go:212 Importing build to rkt                       aci=blablacar.github.io/dgr/aci-gentoo-stage4 path=/home/red/ownCloud/Documents/github/blablacar/dgr/examples/gentoo/aci-gentoo-stage4/target/builder/image.aci
image: using image from file /home/vagrant/github/blablacar/dgr/examples/gentoo/aci-gentoo-stage4/target/builder/image.aci
image: using image from local store for image name blablacar.github.io/dgr/aci-base
08:35:52 INFO        dgr/bin-dgr/aci-build.go:69  Calling rkt to start build                   aci=blablacar.github.io/dgr/aci-gentoo-stage4
image: using image from local store for image name blablacar.github.io/dgr/aci-builder
image: using image from the store with hash sha512-a8847cf598f4b3c32559af02a508b153736cf0cad6e2711f44281c6c81886c4d
08:35:52 INFO          d/a/bin-run/builder.go:65  Building aci                                 aci=aci-gentoo-stage4
Timezone Europe/Paris does not exist in container, not updating container timezone.
06:35:53 DEBUG      dgr/bin-templater/main.go:87  Final attributes resolution                  content=map[]
06:35:53 DEBUG      d/b/template/directory.go:24  Reading template dir                         continueOnError=true dir=/dgr/aci-home/templates
06:35:53 TRACE           d/b/template/file.go:47  Template loaded                              data=&{Uid:0 Gid:0 CheckCmd: fields:map[src:/dgr/aci-home/templates/etc/portage/make.conf.tmpl] Mode:-rw-rw-r-- template:0xc820019260} src=/dgr/aci-home/templates/etc/portage/make.conf.tmpl
06:35:53 TRACE           d/b/template/file.go:70  templating with attributes                   attributes=map[] failOnNoValue=false src=/dgr/aci-home/templates/etc/portage/make.conf.tmpl
06:35:53 INFO            d/b/template/file.go:74  Templating file                              dst=/dgr/aci-target/try/etc/portage/make.conf src=/dgr/aci-home/templates/etc/portage/make.conf.tmpl
06:35:53 TRACE           d/b/template/file.go:98  templating done                              result=# These settings were set by the catalyst build script that automatically
# built this stage.
# Please consult /usr/share/portage/config/make.conf.example for a more
# detailed example.
CFLAGS="-O2 -pipe"
CXXFLAGS="${CFLAGS}"
# WARNING: Changing your CHOST is not something that should be done lightly.
# Please consult http://www.gentoo.org/doc/en/change-chost.xml before changing.
CHOST="x86_64-pc-linux-gnu"
# These are the USE flags that were used in addition to what is provided by the
# profile used for building.
USE="bindist bzip2 idm ipv6 mmx sse sse2 urandom -doc"
PORTDIR="/usr/portage"
DISTDIR="${PORTDIR}/distfiles"
PKGDIR="${PORTDIR}/packages"
ROOT="<no value>"
 src=/dgr/aci-home/templates/etc/portage/make.conf.tmpl
06:35:53 ERROR           d/b/template/file.go:110 Templating result have <no value>           
                         d/b/template/file.go:106 Templating result have <no value>            dst=/dgr/aci-target/try/etc/portage/make.conf line=16 src=/dgr/aci-home/templates/etc/portage/make.conf.tmpl text=ROOT="<no value>"
08:35:53 INFO        dgr/bin-dgr/aci-build.go:90  Finished building aci                        fullname=blablacar.github.io/dgr/aci-gentoo-stage4:20160825.083553-vab1cc0b

Any idea ?

Have a nice day

n0rad commented 8 years ago

I probably introduced this bug. I'm on it

n0rad commented 8 years ago

The problem was in the example. I fixed it.

$ROOTFS exists only when the aci is used in a builder when you run it directly it does not exists so you need an empty string for .rootfs attribute

n0rad commented 8 years ago

9577460f8465a2b010937504d3d47b0c5c06932a

zeysh commented 8 years ago

Hi,

Understood. Many thanks for the explanation. Works perfectly!

Bye