Skip to content

Instantly share code, notes, and snippets.

View austinpapp's full-sized avatar

austin austinpapp

View GitHub Profile

I need to wait for a file (in this case /etc/hosts) to be updated. The current thought is that it may take up to 30mins for this file to be updated. Naturally, wait_for_event seemed the logical fit given the timeout` option.

With that said, i wanted to test out beacons and reactors to handle this. Seemed worthwhile. So i created a little test.

I've dropped a beacon on minion1 and have it watching modify on /etc/hosts. When I copy in a new hosts file on minion1, the beacon picks it up as expected and drops an event on the event bus. All is well there.

However, wait_for_event never sees the event. the orch run times out.

[root@saltmaster minions]# salt-run manage.status
down:
    - syndic
up:
    - minion1

Minion configured

With minion installed. Also, minion config has the master ip set Looking at the manage output, this makes sense to me.

[root@saltmaster ~]# time salt-run manage.status
down:
up:
Failed to execute 'openstack.list_nodes()' while querying for running nodes: <LibcloudError in None 'Could not find specified endpoint'>
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/salt/cloud/__init__.py", line 2369, in run_parallel_map_providers_query
cloud.clouds[data['fun']]()
File "/usr/lib/python2.7/site-packages/salt/cloud/libcloudfuncs.py", line 448, in list_nodes
nodes = conn.list_nodes()
File "/usr/lib/python2.7/site-packages/libcloud/compute/drivers/openstack.py", line 177, in list_nodes
self.connection.request('/servers/detail', params=params).object)
File "/usr/lib/python2.7/site-packages/libcloud/common/openstack.py", line 227, in request
raw=raw)

The following exception was thrown by libcloud when trying to run the initial deployment: 400 Invalid input for field/attribute key_name. Value: None. None is not of type 'string'

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.provider "virtualbox" do |vb|
vb.memory = 1024
end
config.vm.define :master do |master_config|
master_config.vm.box = "bento/centos-7.2"
master_config.vm.host_name = 'saltmaster.local'
{% set ipv6_enabled = [] %}
{% for ip in grains["ipv6"] %}
{% if ip[:12] in ["fe80::a00:27"] %}
echo found {{ ip }}:
cmd.run
echo before {{ ipv6_enabled }}:
cmd.run
{% do ipv6_enabled.append(1) %}
echo after {{ ipv6_enabled }}:
ID: get-pip
Function: file.managed
Name: /tmp/get-pip.py
Result: True
Comment: unless execution succeeded
Started: 21:06:01.890989
Duration: 917.375 ms
Changes:
----------
ID: get-pip
civix:
symfony:
database_driver: pdo_mysql
database_host: 127.0.0.1
database_port:
database_name: civix
database_user: civix
database_password: civix
mailer_transport: smtp
github-ssh-key:
file.managed:
- name: /root/.ssh/{{ salt['pillar.get']('inf-private:github:key-name') }}
- contents_pillar: {{ salt['pillar.get']('inf-private:github:key') }}
- mode: 600