apt-formula icon indicating copy to clipboard operation
apt-formula copied to clipboard

Less an issue -- more a question

Open jdkelleher opened this issue 5 years ago • 2 comments

Why have update and upgrade only run when sources.list or sources.list.d are changed?

This means it can't be run as a maintenance job. I'm new to Saltstack formulas, so am I missing something obvious?

I modified and tested the formula to use additional pillar data, "always_update" and "always_upgrade" to enable the maintenance behavior, e.g.

{% from "apt/map.jinja" import apt as apt_map with context %}
{% set apt = pillar.get('apt', {}) %}
{% set always_update = apt.get('always_update', apt_map.always_update) %}

apt-get -y update:
  {% if always_update %}
  cmd.run
  {% else %}
  cmd.wait:
    - watch:
      - file: /etc/apt/sources.list
      - file: /etc/apt/sources.list.d
  {% endif %}

Any interesting in a pull request?

jdkelleher avatar Apr 27 '19 20:04 jdkelleher

Looking at the README  I see there are two states apt.update and apt.upgrade so you should be able to just run those and have and update/upgrade, did you tried this?

daks avatar Apr 28 '19 08:04 daks

Looking at the README  I see there are two states apt.update and apt.upgrade so you should be able to just run those and have and update/upgrade, did you tried this?

Tried that as shown below....

kelleher@buffet:~$ sudo salt 'vsi02' state.apply apt.update
vsi02:
----------
          ID: apt-get update
    Function: cmd.wait
      Result: False
     Comment: The following requisites were not found:
                                 watch:
                                     file: /etc/apt/sources.list
                                     file: /etc/apt/sources.list.d
     Started: 14:31:56.468828
    Duration: 0.043 ms
     Changes:   

Summary for vsi02
------------
Succeeded: 0
Failed:    1
------------
Total states run:     1
Total run time:   0.043 ms
ERROR: Minions returned with non-zero exit code
kelleher@buffet:~$ 

This aligns with a commit on 2016-04-23, but not sure why the change was made - https://github.com/saltstack-formulas/apt-formula/commit/7c7cd9f9a81ab4386c5342d355d9c043c43945d0

jdkelleher avatar Apr 28 '19 18:04 jdkelleher