Kevin's picture

Hi, I've just inherited a Turnkey VM which we use to create ISOs of our product.

I've just been tasked with putting in openVPN and easy-RSA (much like ssh) into this deployment for a new feature that has been added.

I've pieced thru the make files (not an easy feat) and come up in the /usr/share/fab/product.mk file.   I've noted that the fab-plan-resolve call creates a list of all the files to download into the ISO by using the command:

fab-plan-resolve plan/main  --bootstrap=/turnkey/fab/bootstraps/wheezy --output=build/root.spec -D 'FAB_ARCH=amd64' -D 'FAB_HTTP_PROXY=http://127.0.0.1:8124' -D 'AMD64=y' -D 'RELEASE=debian/wheezy' -D 'DISTRO=debian' -D 'CODENAME=wheezy' -D 'DEBIAN=y'

But when I try to run that command by itself I get an error:

Traceback (most recent call last):
  File "/usr/lib/fab/wrapper.py", line 34, in <module>
    CliWrapper.main()
  File "/usr/lib/python2.7/dist-packages/pyproject.py", line 388, in main
    commands.run(name, args)
  File "/usr/lib/python2.7/dist-packages/pyproject.py", line 261, in run
    command.module.main()
  File "/usr/lib/fab/pylib/cmd_plan_resolve.py", line 119, in main
    subplan = Plan.init_from_file(arg, cpp_opts, pool_path)
  File "/usr/lib/fab/pylib/plan.py", line 204, in init_from_file
    return cls(cls._parse_plan_file(plan_file_path, cpp_opts), pool_path)
  File "/usr/lib/fab/pylib/plan.py", line 182, in _parse_plan_file
    processed_plan = cpp.cpp(path, cpp_opts)
  File "/usr/lib/fab/pylib/cpp.py", line 80, in cpp
    raise ExecError(" ".join(command), e.exitcode, trapped_stderr)
executil.ExecError: non-zero exitcode (1) for command: cpp plan/main -Ulinux -DFAB_ARCH=amd64 -DFAB_HTTP_PROXY=http://127.0.0.1:8124 -DAMD64=y -DRELEASE=debian/wheezy -DDISTRO=debian -DCODENAME=wheezy -DDEBIAN=y
plan/main:1:24: fatal error: turnkey/base: No such file or directory
compilation terminated
.

Can anybody point me to why this calls fails because of a non-existant directory but normally runs fine and / or how can I add these 2 new packages into the ISO?

 

Thanks,

Kevin

 

 

Forum: 
Tags: 
Jeremy Davis's picture

So my guess is that Fab uses a relative path to locate plan/main (absolute path should be /turnkey/fab/common/plans/turnkey/base). But when you run it directly for some reason it is not expanding the relative paths to absolute ones. I don't know the insides of Fab well enough to point you in the right direction; but my guess is that something in the chain of makefiles prior to 'fab-plan-resolve' sets it up to be able to find the relative paths...

Out of interest I just had a quick play to test my conjecture and it seems to be sound... I edited plan/main to use absolute paths, so:

#include <turnkey/base>
...
becomes:
#include </turnkey/fab/common/plans/turnkey/base>
...
That gets us a little further but now we encounter issues with the relative paths in /turnkey/fab/common/plans/turnkey/base:
root@tkldev products/lamp# fab-plan-resolve plan/main  --bootstrap=/turnkey/fab/bootstraps/jessie --output=build/root.spec -D 'FAB_ARCH=amd64' -D 'FAB_HTTP_PROXY=http://127.0.0.1:8124' -D 'AMD64=y' -D 'RELEASE=debian/jessie' -D 'DISTRO=debian' -D 'CODENAME=jessie' -D 'DEBIAN=y'
Traceback (most recent call last):
  File "/usr/lib/fab/wrapper.py", line 34, in 
    CliWrapper.main()
  File "/usr/lib/python2.7/dist-packages/pyproject.py", line 388, in main
    commands.run(name, args)
  File "/usr/lib/python2.7/dist-packages/pyproject.py", line 261, in run
    command.module.main()
  File "/usr/lib/fab/pylib/cmd_plan_resolve.py", line 119, in main
    subplan = Plan.init_from_file(arg, cpp_opts, pool_path)
  File "/usr/lib/fab/pylib/plan.py", line 204, in init_from_file
    return cls(cls._parse_plan_file(plan_file_path, cpp_opts), pool_path)
  File "/usr/lib/fab/pylib/plan.py", line 182, in _parse_plan_file
    processed_plan = cpp.cpp(path, cpp_opts)
  File "/usr/lib/fab/pylib/cpp.py", line 80, in cpp
    raise ExecError(" ".join(command), e.exitcode, trapped_stderr)
executil.ExecError: non-zero exitcode (1) for command: cpp plan/main -Ulinux -DFAB_ARCH=amd64 -DFAB_HTTP_PROXY=http://127.0.0.1:8124 -DAMD64=y -DRELEASE=debian/jessie -DDISTRO=debian -DCODENAME=jessie -DDEBIAN=y
In file included from plan/main:1:0:
/turnkey/fab/common/plans/turnkey/base:1:16: fatal error: boot: No such file or directory
 #include 
                ^
compilation terminated.

Out of interest I tried to see if it would still work with the absolute paths hardcoded and it appears to (although TBH I did test making all the way to ISO):

root@tkldev products/lamp# make root.spec
deck /turnkey/fab/bootstraps/jessie build/bootstrap
fab-apply-overlay /turnkey/fab/common/overlays/turnkey.d/apt build/bootstrap;
fab-chroot build/bootstrap --script /turnkey/fab/common/conf/turnkey.d/apt;
fab-chroot build/bootstrap "echo nameserver 8.8.8.8 > /etc/resolv.conf";
fab-chroot build/bootstrap "echo nameserver 8.8.4.4 >> /etc/resolv.conf";
touch build/stamps/bootstrap
fab-plan-resolve plan/main  --bootstrap=/turnkey/fab/bootstraps/jessie --output=build/root.spec -D 'FAB_ARCH=amd64' -D 'FAB_HTTP_PROXY=http://127.0.0.1:8124' -D 'AMD64=y' -D 'RELEASE=debian/jessie' -D 'DISTRO=debian' -D 'CODENAME=jessie' -D 'DEBIAN=y'
touch build/stamps/root.spec

(and build/root.spec contains the package list for LAMP...)

So out of interest, what exactly are you trying to achieve? If you merely need to add some packages then add them to plan/main (or make a new plan/file). If you need to execute some other code then edit conf.d/main (or make a new conf.d/file - remember need to make it executable and conf.d scripts are processed in alpha-numeric order...)

Also as an FYI; whilst still technically only an RC TKLDev v14.0 is working pretty nicely if you wanted to try a v14.x/Jessie based build! :)

Add new comment