Invalid config for - Travis CI

Recently my builds failed in Travis CI, after a whole night of surveys it became clear to me that Travis is missing some files.


sensor.filesize: 
    - Invalid config for [sensor.filesize]: not a file @ data['file_paths'][0]. Got '/home/homeassistant/.homeassistant/home-assistant_v2.db'
not a file @ data['file_paths'][1]. Got '/home/homeassistant/.homeassistant/home-assistant.log'
not a file @ data['file_paths'][2]. Got '/home/homeassistant/.homeassistant/configuration.yaml'. (See ?, line ?). Please check the docs at https://home-assistant.io/components/sensor.filesize/
    - platform: filesize
      file_paths: [source /home/travis/build/klaasnicolaas/Smarthome-homeassistant-config/./sensors/hass_stats.yaml:16]
        - /home/homeassistant/.homeassistant/home-assistant_v2.db
        - /home/homeassistant/.homeassistant/home-assistant.log
        - /home/homeassistant/.homeassistant/configuration.yaml
      name: Filesize Database

The question now is how do I manage to ensure that Travis does not miss these files, or possibly skip them? I also have the same problem with the SSL files.

Is not the intention that my entire database will be included in the upload to github. So maybe something of a dummy content should occur?

1 Like

I have worked around this by adding file paths as secrets. See my repo and Travis config. Link in my profile.

Or create blank dummy files in your repo and move them in before Travis executes, like you do with the dummy secrets file.

I’ve tried adding these lines in my travis_secret.yaml file. It just does not work :frowning:

filesize_homeassistant_db: ./home-assistant_v2.db
filesize_homeassistant_log: ./home-assistant.log
filesize_ozw_log: ./OZW_Log.txt

and in travis file:
  - touch ./home-assistant_v2.db
  - touch ./home-assistant.log
  - touch ./OZW_Log.txt

I think this works the best, I had some dummy files made but that did not grab home assistant yet or do I have to refer to it in the travis file with a mv?

Yeah, presumably your travis.yml already has a line something like

before_install:
  - mv fake_secrets.yaml secrets.yaml 

So below that add:

  - mv fake_database.db home-assistant_v2.db

etc

But what if they are located in a subfolder? If I do:

- mv testserver.pem server.pem

I got this error:

mv: cannot stat ‘test.pem’: No such file or directory
 - mv path/to/fake_database.db home-assistant_v2.db

My Travis (with secrets in a different folder)…

link removed

Unfortunately it does not make any difference I still get the same error as my first message.

- mv /dummy/travis_home-assistant_v2.db home-assistant_v2.db

Possibly because travis doesn’t create a homeassistant user, so the file you’re moving is to travis’ home directory, but the path you’re looking for is as configured on your system.

Do you need the full file path in your sensor definition? Could it not just be the filename?

After a lot of tests I finally succeeded. I wonder if I could possibly do better the way I did now. I see that some indeed have a much shorter path link but I do not manage to get that shorter

I have now used this code:
Travis_secrets: (the path links to dummy content on github)

filesize_homeassistant_db: /home/travis/build/klaasnicolaas/Smarthome-homeassistant-config/dummy/travis_home-assistant_v2.db
filesize_homeassistant_log: /home/travis/build/klaasnicolaas/Smarthome-homeassistant-config/dummy/travis_home-assistant.log
filesize_ozw_log: /home/travis/build/klaasnicolaas/Smarthome-homeassistant-config/dummy/travis_OZW_Log.txt

File sensor: (it takes the paths from the secrets file)

- platform: filesize
  name: Filesize Database
  file_paths:
      - !secret filesize_homeassistant_db
      - !secret filesize_homeassistant_log
      - !secret filesize_ozw_log

I tried that too at first, but Travis gives permission denied for:

$ mkdir -p  /config
$ touch /config/home-assistant_v2.db

From my repo

.travis.yml

language: python
python:
  - "3.6.3"
before_install:
  - mv travis_secrets.yaml secrets.yaml
  - touch ./home-assistant_v2.db
  - touch ./home-assistant.log
  - touch ./OZW_Log.txt
install:
  - pip3 install homeassistant
  - hass --version
script:
- hass -c . --script check_config

travis_secrets.yaml

filesize_homeassistant_db: ./home-assistant_v2.db
filesize_homeassistant_log: ./home-assistant.log
filesize_ozw_log: ./OZW_Log.txt

packages/system.yaml

sensor:
  - platform: filesize
    file_paths:
      - !secret filesize_homeassistant_db
      - !secret filesize_homeassistant_log
      - !secret filesize_ozw_log

Can you tell me what “touch ./” does?

Have had a lot of your repo and partly used.

The command

$ touch ./home-assistant_v2.db

creates an empty file home-assistant_v2.db in the current working directory

1 Like

I’m going to try this again, only with me that ./ option does not work. must then enter the entire path.

I only use ./home-assistant_v2.db for travis. In my actual hass.io config it is /config/home-assistant_v2.db

With the Travis setup I managed to use a ./ and that works fine now :slight_smile:
But in my secrets file I really have to enter the full path otherwise I get an error :frowning:

I need to do this, too.