Failed to compile SLS file - salt-stack

I have a sls file in the path /srv/salt/server3.sls.
Its content is
git:
pkg:
- installed
When I run the SLS as
sudo salt 'ubuntu' state.sls server3
It gives the following error
ubuntu:
Data failed to compile:
----------
ID git in SLS server3 is not a dictionary
----------
ID pkg in SLS server3 is not a dictionary
What wrong am I doing here? please help me with this

yaml cares about indentation. this is a yaml error
git:
pkg:
- installed
you want to indent pkg two spaces under git
git:
pkg:
- installed
If you run a state through yaml lint before saving it, you'll see the errors.
Here is the result of your state:
---
git: ~
pkg:
- installed
notice that git is an empty list.

I had the same error today (thats how I found this). At the end it was an identation error. Mixed tabs and spaces.
In your case try:
git:
pkg.installed

Related

Github Actions - How to compile SCSS to CSS in CI build time?

I am unsure how people are compiling scss files to css files in Github Actions' CI build time . Here is my way of doing it. Please let me know if it's the wrong way to approach it.
Here is my github repo:
https://github.com/mattfrancis888/gh_actions_heroku
Here is my project directory
.github
-> workflows
-> main.yml
src
pages
->app.ts
scss
-> main.scss
-> main.css (untracked in git & not pushed to remote repoistory, it is used locally
; github actions should compile the main.scss file and create a main.css file at CI build time)
package.json
Here is my main.yml, I am following Sass Build Action as the template to convert .scss to. css at CI build time. (SASS Build Action seems to have very little activity & support on it)
build:
runs-on: ubuntu-latest
steps:
- name: Checkout source Git branch
uses: actions/checkout#v2
with:
ref: main
fetch-depth: 10
submodules: true
- name: Compile CSS from SCSS files
uses: gha-utilities/sass-build#v0.4.7
with:
source: /src/scss/main.scss #I have removed the / in /src and it is still failing
destination: /src/scss/main.css
#deploys to heroku (unrelated to SASS Build Action)
- uses: actions/checkout#v2
- uses: akhileshns/heroku-deploy#v3.12.12 # This is the action
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: "ga" #Must be unique in Heroku
heroku_email: "a88#gmail.com"
When I use SASS to try to compile .scss files to .csss files, I am receiving this error in github action's step at "Compile CSS from SCSS files" :
Error: /src/scss/main.scss: no such file or directory
at Object._newRenderError (/home/runner/work/_actions/gha(internal/modules/cjs/loader.js:995:10) {
formatted: 'Error: /src/scss/main.scss: no such file or directory',
status: 3
}
Update
This is fixed by #'Matthias' answer by changing the main.yml to
with:
source: ./src/scss/main.scss
destination: ./src/scss/main.css
However, I am met with the following error now:
Here is the output that is working in step: Compile SCSS files to CSS:
Run gha-utilities/sass-build#v0.4.7
Warning: ENOENT: no such file or directory, stat './src/scss/main.css'
Attempting to write to file path -> ./src/scss/main.css
Wrote file -> ./src/scss/main.css
This is the error in the next step when trying to deploy it to heroku.
remote: Failed to compile.
remote: remote: ./pages/_app.tsxremote:
Module not found: Can't resolve '../src/scss/main.css' in '/tmp/build_9673181c/pages'
It looks like main.csss is not created in src/scss at the CI build time. Why is that?
Did you try to put an . before the /?
As a dot means from right here go there. ;-)
So it would be:
./src/scss/main.scss

No matching sls found for 'httpd' in env 'base'

I am trying to install and set-up some basic saltstack states.
I am getting the following error when trying to apply a state:
No matching sls found for 'httpd' in env 'base'
My setup is as follows:
Centos 7.7.1908
Salt 3000
My directory structure is:
/etc/salt/srv/salt/httpd.sls
And my file contains:
install_httpd:
pkg.installed:
- httpd
The command I am running is:
salt minion state.sls httpd
I have also tried created a top.sls file under:
/etc/salt/srv/pillar/top.sls
And this file contains:
base:
'*':
- httpd
But I get the same error. However, as far as I am aware, a top.sls file should not be necessary.
Does anyone have any suggestions on this?
Cheers
So, I found the answer to my own question.
I was assuming that /srv/salt/ should exist within /etc/salt/, which was incorrect. /srv/salt/ should be its own directory. So if I run pwd while inside /srv/salt/ it looks like this:
/srv/salt
If you want to change this so that /srv/salt can sit within /etc/salt/ you will need to adjust your file_roots on line 667 of /etc/salt/master to be:
file_roots:
base:
- /etc/salt/srv/salt

Symfony/Codeception Run Errors

I have a Symfony 2.4.4 site with simple Codeception (2.1.7) acceptance tests setup. When running the acceptance tests I get the following error:
[Codeception\Exception\ConfigurationException]
AcceptanceTester class doesn't exist in suite folder.
Run the 'build' command to generate it
The AcceptanceTester class does exist in the tests/acceptance directory. If I run a build I get the following error:
[Codeception\Exception\ConfigurationException]
Configuration file could not be found.
Run `bootstrap` to initialize Codeception.
The codeception.yml file does exist and contains the following:
actor: Tester
paths:
tests: tests
log: tests/_output
data: tests/_data
helpers: tests/_support
settings:
bootstrap: _bootstrap.php
colors: false
memory_limit: 1024M
coverage:
enabled: true
remote: true
include:
- app/*
exclude:
- app/cache/*
include:
...
modules:
config:
Db:
dsn: ''
user: ''
password: ''
dump: tests/_data/dump.sql
If I run a bootstrap it confirms this:
Project is already initialized in '.'
acceptance.suite.yml contains:
class_name: AcceptanceTester
modules:
enabled:
- AcceptanceHelper
Any suggestions?
AcceptanceTester.php file should be in tests/_support directory.
Run codecept build to regenerate Tester files.
You have no modules enabled acceptance.suite.yml.
You have to enable one of Symfony2, PhpBrowser and WebDriver.
Your site uses an old version of Symfony and it can cause issues for Codeception if Symfony2 module is used, so I recommend to test it using PhpBrowser or WebDriver.
I believe, you need to run command codecept bootstrap.
I had this problem, and I realise that I ran the codecept bootstrap but the vendor and the tests folders were in a wrong directory.
I followed this video and it helped me.

SaltStack error: State *.basic found in sls test.test is unavailable

I'm trying to use Salt to deploy an online tool to a new VPS. The process involves cloning a git repo and then various set-up commands - however there seems to be an issue with including other .sls files from within sub directories.
Here's a simplified version:
Master config file:
file_roots:
base:
- /srv/salt/saltstates
I have a a file in /srv/salt/saltstates/test/test.sls containing:
base:
'*':
- basic
The file /srv/salt/saltstates/test/basic.sls contains:
Europe/London:
timezone.system
However, when I run salt 'Minion1' state.sls test.test, an error is returned:
Minion1:
----------
ID: base
Function: *.basic
Result: False
Comment: State *.basic found in sls test.test is unavailable
Started:
Duration:
Changes:
OK, so you've confused several things here.
First of all the contents you've put in /srv/salt/saltstates/test/test.sls really is what is called a top file and should probably be moved to /srv/salt/saltstates/top.sls
The top.sls is only needed if you want to do a highstate, but since you're trying to run salt 'Minion1' state.sls test.test you don't really need the top.sls.
Now since you have your sls file here: /srv/salt/saltstates/test/basic.sls, then the command you want to run is the following:
salt 'Minion1' state.sls test.basic
The "dot" traverses down directories.

Problems with basic usage of saltstack apache-formula

I'm new to Saltstack and I'm just trying to do some simple installs on a subset of minions. I want to include Environments so I have my file roots as:
file_roots:
base:
- /srv/salt/base
dev:
- /srv/salt/dev
qa:
- /srv/salt/qa
stage:
- /srv/salt/stage
prod:
- /srv/salt/prod
I set up the git backend:
fileserver_backend:
- git
- roots
I'm using gitfs set as:
gitfs_remotes:
- https://github.com/saltstack-formulas/postgres-formula
- https://github.com/saltstack-formulas/apache-formula
- https://github.com/saltstack-formulas/memcached-formula
- https://github.com/saltstack-formulas/redis-formula
So I have the master set up and I add top.sls to /srv/salt/stage with
include:
- apache
stage:
'stage01*':
- apache
But I get an error when I execute
salt -l debug \* state.highstate test=True
Error
stage01.example.net:
Data failed to compile:
----------
No matching sls found for 'apache' in env 'stage'
I've tried many ways and the master just can't seem to find the apache formula I configured for it.
I found the answer and it was sitting in the Saltstack docs the whole time.
First you will need to fork the current repository such as postgres-formula.
Depending on the environment create a branch of the same name in your newly create fork of the repo.
So for example I wanted to use postgres in my stage environment. So it wouldn't work until I created a branch named stage ined my forked repo of postgres-formula then it worked like a charm.

Resources