saltstack-formulas / aptly-formula Goto Github PK
View Code? Open in Web Editor NEWHome Page: http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
License: Other
Home Page: http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
License: Other
re: create mirrors, the unless statement (aptly mirror show ) returns true, so the command is not executed - but returns false (not found) if run from the command line. Any clue?
root@saltmin05:~# aptly mirror show ubuntu-trusty ; echo $?
ERROR: unable to show: mirror with name ubuntu-trusty not found
1... (cut begging of salt apply output to node above)
ID: add_40976EAF437D05B5_gpg_key
Function: cmd.run
Name: gpg --no-default-keyring --keyring trustedkeys.gpg --keyserver keys.gnupg.net --recv-keys 40976EAF437D05B5
Result: True
Comment: Command "gpg --no-default-keyring --keyring trustedkeys.gpg --keyserver keys.gnupg.net --recv-keys 40976EAF437D05B5" run
Started: 14:50:27.047222
Duration: 515.744 ms
Changes:
----------
pid:
4545
retcode:
0
stderr:
gpg: requesting key 437D05B5 from hkp server keys.gnupg.net
gpg: key 437D05B5: "Ubuntu Archive Automatic Signing Key [email protected]" not changed
gpg: Total number processed: 1
gpg: unchanged: 1
stdout:
ID: add_3B4FE6ACC0B21F32_gpg_key
Function: cmd.run
Name: gpg --no-default-keyring --keyring trustedkeys.gpg --keyserver keys.gnupg.net --recv-keys 3B4FE6ACC0B21F32
Result: True
Comment: Command "gpg --no-default-keyring --keyring trustedkeys.gpg --keyserver keys.gnupg.net --recv-keys 3B4FE6ACC0B21F32" run
Started: 14:50:27.563913
Duration: 379.507 ms
Changes:
----------
pid:
4568
retcode:
0
stderr:
gpg: requesting key C0B21F32 from hkp server keys.gnupg.net
gpg: key C0B21F32: "Ubuntu Archive Automatic Signing Key (2012) [email protected]" not changed
gpg: Total number processed: 1
gpg: unchanged: 1
stdout:
ID: create_ubuntu-trusty_mirror
Function: cmd.run
Name: aptly mirror create -architectures='amd64' ubuntu-trusty http://us.archive.ubuntu.com/ubuntu/ trusty main
Result: True
Comment: unless execution succeeded
Started: 14:50:27.945660
Duration: 272.457 ms
Changes:
Summary for saltmin05Succeeded: 21 (changed=4)
Failed: 1
When running the formula I'm getting the following error message -
Data failed to compile:
ID 'bzip2' in SLS 'aptly' contains a short declaration (pkg.installed) with a trailing colon. When not passing any arguments to a state, the colon must be omitted.
...with the following error:
----------
ID: aptly_user
Function: user.present
Name: aptly
Result: False
Comment: Failed to create new user aptly
Started: 13:14:41.167389
Duration: 24.448 ms
Changes:
in the logs state is rendered as below:
aptly_user:
group.present:
- name: aptly
user.present:
- name: aptly
- shell: /bin/bash
- home: /var/lib/aptly
- require:
- pkg: aptly_packages
command fails with:
[INFO ] Running state [aptly] at time 13:14:41.167389
[INFO ] Executing state user.present for [aptly]
[DEBUG ] LazyLoaded shadow.info
[DEBUG ] LazyLoaded user.info
[INFO ] Executing command useradd in directory '/root'
[ERROR ] Command 'useradd' failed with return code: 9
[ERROR ] stderr: useradd: group aptly exists - if you want to add this user to that group, use -g.
[ERROR ] retcode: 9
[ERROR ] Failed to create new user aptly
[INFO ] Completed state [aptly] at time 13:14:41.191837 (duration_in_ms=24.448)
here:
Lines 43 to 49 in be02d75
to fix it just add else:
{% if aptly.user.gid %}
- gid: {{ aptly.user.gid }}
- gid_from_name: True
{% else %}
- gid: {{ aptly.groupname }}
{% endif %}
let me know if I misunderstood something.
gpg_passphrase needs outer double quotes so that salt will pass through the single quotes on the value. The state run will fail if the gpg_passphrase value contains spaces and is not quoted.
I really don't feel the state aptly_repo
belongs in init.sls, that will run in jessie and install the wrong version of aptly. We could wrap in a condition, but I lean towards leaving that out altogether. I feel if someone needs a repo they can add that in a state before the aptly formula is run, no? And it could very well be their own private deb repo anyway.
Running Salt 2016.11.3 and keep having issues with the create_mirrors
state failing saying that the Jinja variable keyid
is undefined.
This is what my mirrors
pillar section looks like:
mirrors:
datadog:
url: https://apt.datadoghq.com
distribution: stable
components:
- main
- 6
keyid:
- 382E94DE
architectures:
- amd64
trusty-docker-engine:
url: https://apt.dockerproject.org/repo
distribution: ubuntu-trusty
components:
- main
key_url: https://apt.dockerproject.org/gpg
architectures:
- amd64
xenial-docker-engine:
url: https://apt.dockerproject.org/repo
distribution: ubuntu-xenial
components:
- main
key_url: https://apt.dockerproject.org/gpg
architectures:
- amd64
trusty-docker-ce:
url: https://download.docker.com/linux/ubuntu
distribution: trusty
components:
- main
key_url: https://download.docker.com/linux/ubuntu/gpg
architectures:
- amd64
xenial-docker-ce:
url: https://download.docker.com/linux/ubuntu
distribution: xenial
components:
- main
key_url: https://download.docker.com/linux/ubuntu/gpg
architectures:
- amd64
trusty-saltstack-2016_11_3:
url: http://repo.saltstack.com/apt/ubuntu/14.04/amd64/archive/2016.11.3/
distribution: trusty
components:
- main
key_url: http://repo.saltstack.com/apt/ubuntu/14.04/amd64/archive/2016.11.3/SALTSTACK-GPG-KEY.pub
architectures:
- amd64
xenial-saltstack-2016_11_3:
url: http://repo.saltstack.com/apt/ubuntu/16.04/amd64/archive/2016.11.3/
distribution: xenial
components:
- main
key_url: http://repo.saltstack.com/apt/ubuntu/16.04/amd64/archive/2016.11.3/SALTSTACK-GPG-KEY.pub
architectures:
- amd64
trusty:
url: http://us-east-1.ec2.archive.ubuntu.com/ubuntu/
distribution: trusty
components:
- main
- restricted
- universe
- multiverse
keyid:
- 437D05B5
architectures:
- amd64
trusty-updates:
url: http://us-east-1.ec2.archive.ubuntu.com/ubuntu/
distribution: trusty-updates
components:
- main
- restricted
- universe
- multiverse
keyid:
- 437D05B5
architectures:
- amd64
trusty-backports:
url: http://us-east-1.ec2.archive.ubuntu.com/ubuntu/
distribution: trusty-backports
components:
- main
- restricted
- universe
- multiverse
keyid:
- 437D05B5
architectures:
- amd64
trusty-security:
url: http://us-east-1.ec2.archive.ubuntu.com/ubuntu/
distribution: trusty-security
components:
- main
- restricted
- universe
- multiverse
keyid:
- 437D05B5
architectures:
- amd64
xenial:
url: http://us-east-1.ec2.archive.ubuntu.com/ubuntu/
distribution: xenial
components:
- main
- restricted
- universe
- multiverse
keyid:
- C0B21F32
architectures:
- amd64
xenial-updates:
url: http://us-east-1.ec2.archive.ubuntu.com/ubuntu/
distribution: xenial-updates
components:
- main
- restricted
- universe
- multiverse
keyid:
- C0B21F32
architectures:
- amd64
xenial-backports:
url: http://us-east-1.ec2.archive.ubuntu.com/ubuntu/
distribution: xenial-backports
components:
- main
- restricted
- universe
- multiverse
keyid:
- C0B21F32
architectures:
- amd64
xenial-security:
url: http://us-east-1.ec2.archive.ubuntu.com/ubuntu/
distribution: xenial-security
components:
- main
- restricted
- universe
- multiverse
keyid:
- C0B21F32
architectures:
- amd64
Any assistance would be appreciated
We need to update all of the items in this formula from:
pkg:
- managed
to:
pkg.managed:
and so on.
When you have a significant number of repos with a significant number of keys often shared between many repos, the key server can interpret your calls as aggressive and fail the requests.
In our case the formula 'aptly.create_mirrors' calls over 101 states.
or else the template won't render the pillar details :)
Many repositories need more than one key in the gpg keyring to allow mirroring.
Formulas iterating over dictionaries should use the items()
method instead of iteritems()
because the latter method has been removed from Python 3. While the items()
method in Python 2 uses more memory than iteritems()
, these dictionaries are typically small (e.g., sets of settings from Pillar).
Default init
state throws unhandled exceptions on CentOS.
The states should run on most Linux without ugly exceptions.
jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'pkgs'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/salt/utils/templates.py", line 169, in render_tmpl
output = render_str(tmplstr, context, tmplpath)
File "/usr/lib/python3.6/site-packages/salt/utils/templates.py", line 402, in render_jinja_tmpl
buf=tmplstr)
salt.exceptions.SaltRenderError: Jinja variable 'dict object' has no attribute 'pkgs'
[CRITICAL] Rendering SLS 'base:aptly' failed: Jinja variable 'dict object' has no attribute 'pkgs'
local:
Data failed to compile:
----------
Rendering SLS 'base:aptly' failed: Jinja variable 'dict object' has no attribute 'pkgs'
I want to use aptly to mirror a local unsigned repository. To do this on the command line i would add the -ignore-signatures=true
flag to the aptly mirror create
command. I didn't see that option in the pillar.example and wonder if there is a way to pass additional flags to the commands.
I am new to Salt, so I apologize if this is an obvious question.
In the nginx.sls
file, nginx.ng.config
is included.
But there is a breaking change from the v1.0.0 of nginx-formula
.
It would be necessary to change nginx.ng.config
to nginx.config
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.