Commit Graph

51 Commits

Author SHA1 Message Date
ricolin 53800d1057 Remove docs, deprecated hooks, tests
Remove all deprecated hooks and tests.
Also since all test and hooks are removed,
we can remove the declare of python language in classifier.
Since we didn't actually provide any document,
we should remove docs too.

Hooks are maintained as Agents under heat-agents repo now.
Hooks in heat-templates are deprecated for a while. Hence, remove
hooks in heat-templates.

Depends-On: https://review.openstack.org/#/c/584774/
Change-Id: Ia886f71eaf99d75db0f9a6a7dfbe8664995c26e7
2019-01-03 20:18:06 +13:00
Jenkins 01b1768740 Merge "Add a hook to help write json files" 2017-01-09 23:03:28 +00:00
Dan Prince 08725114a8 Add a hook to help write json files
This patch adds a new Heat software configuration hook that
can be used to generate Json config files in a composable manner
within Heat templates.

This can be useful for everything from providing data to ad-hoc
scripts from configuring kolla containers.

Change-Id: I2b372ac2e291339e436202c9fe58a681ed6a743f
2017-01-01 14:59:00 -05:00
Sofer Athlan-Guyot 7e98f208ed Enable the use of a non-standard module-path for ansible.
This mirror the puppet hook.

Closes-Bug: #1651825
Change-Id: I19006c531591e9c02a95448007707c3f4a013633
2016-12-23 12:10:35 +01:00
Steve Baker d10069ac13 docker-cmd hook handle empty config file
Early in a server boot the file /var/run/heat-config/heat-config may
exist but be empty. This causes a stack trace to be raised in this
script.

This change detects a json parse error and exits gracefully.

Change-Id: I29d731098659bfbf10a2caf80c2cfc49de5df4cc
Closes-Bug: #1648249
2016-12-13 09:57:52 +13:00
Steve Baker 8ab13c5489 Do docker operations in a defined order
This fixes the heat-templates gate

Change-Id: If171d93408e9252606454ce61e5923502649d2bc
2016-12-13 09:57:52 +13:00
Jenkins 67e02ce57c Merge "Allow ansible inventory to be configurable" 2016-12-06 02:52:58 +00:00
Jenkins a6a6861ff1 Merge "docker-cmd hook" 2016-11-16 03:07:12 +00:00
Steven Hardy 3aeb4359b9 Correct tags option position in ansible hook
I made a mistake with the argument ordering, these need to go
before the playbook name

Change-Id: If7d2dc9f9a09d1c9feb78c3a8cbb2980c3e647f4
2016-11-15 18:38:17 +00:00
Juan Antonio Osorio Robles af01bb96ce Set content-type for SoftwareConfig's heat-config-notify
What the heat-config-notify actually POSTs/PUTs to heat is JSON, so
the content-type should be updated as such.

Change-Id: I85e116bec524ba37e96c5761346084ab149601cc
Related-Bug: #1641589
2016-11-14 16:59:22 +02:00
Alex Schultz b1714b244d Add local logging output to puppet hook
This change updates the puppet hook to write out logs to the local node
if verbose or debug is enabled for the hook. The logs will be written
out to the /var/log/puppet/ folder that currently is empty at all times.
We will continue to output logs to the console for the traditional heat
processing of the stdout and stderr but will also write out the logs
locally only if debug or verbose is enabled for the puppet apply.

Change-Id: Idfbfc030350827a4653b26cef7c7deca92b0e05d
Closes-Bug: #1536009
2016-11-08 09:08:21 -07:00
Steve Baker 2baf44a32c docker-cmd hook
This hook takes the same format as the docker-compose hook, but makes
calls directly to the docker command rather than calling
docker-compose.

This hook currently supports the docker-compose v1 format, but in the
future will support other formats such as the kubernetes pod format.

TripleO will adopt this hook and will transition to using the pod
format when this hook supports it.

Co-Authored-By: Ian Main <imain@redhat.com>

Change-Id: I699107c3df64723a945c5d5ac82ae3a48b76700e
2016-11-04 16:13:18 +13:00
Steven Hardy 06205231a3 Add option to pass tags to the ansible hook
Currently we don't support options for the ansible hook, but it would
be useful to enable passing tags, like we already do for the puppet
hook.

Change-Id: Idf7e3aa520fd40a2c4c00b2d26c3c608059bb51d
2016-11-03 17:43:51 +00:00
Dan Prince 40a4ed0841 A hook which writes hiera datafiles.
This patch creates a hook that writes hiera.yaml and datafiles
to disk. This approach works well for users (like TripleO)
who prefer to maintain Hiera in a more composable manner with
Heat structured config resources rather than specifying all
the Hiera values for each puppet config resource.

Partial-bug: #1596373

Change-Id: I21639f6aadabf9e49f40d1bb0b1d0edcfc4dbc5e
2016-10-05 21:29:02 -04:00
Dan Prince 7c5aae183a A hook which invokes os-apply-config.
The intent is for this element (hook script) to be used in place of the
one in tripleo-image-elements which relies on an external signal handling
shell script at the end of the os-refresh-config run
(99-refresh-completed).

This version will run os-apply-config and return a signal immediately.
Because it uses the heat-hook mechanisms it also supports a broader set of
signal handling capabilities... which 99-refresh-completed doesn't fully
support.

Change-Id: Ic9402ff93cbc840bec1debcd8881de563d03cbf0
2016-09-29 14:46:45 -04:00
Pablo Caruana 497cf075f7 Fix some typos
Change-Id: I87f3328a13767367e6ade54217a226f6b660975a
2016-07-19 18:01:30 +02:00
SamYaple 5e21990e81 Allow ansible inventory to be configurable
This allow the user to pass a string (or path to a file) for the
ansible inventory so it is not just localhost. This is important for
things like setting up groups and possible inventory scoped variables.

Added test to ensure ansible is getting called properly using the ENV
inventory value.

Change-Id: I9440ff9dae3595a1c57b2511f03792105f1beb88
2016-06-14 21:45:39 +00:00
Jenkins e609434170 Merge "Trivial: Remove vim header from source files" 2016-04-05 13:00:18 +00:00
Randall Burt 2534497008 Chef-Zero software config hook
Implements a software config hook for using chef-zero, an in-memory,
standalone chef service. Chef-Zero has replaced chef-solo as the
preferred serverless implementation, therfore this patch replaces
the previous chef-solo patch at https://review.openstack.org/#/c/80229/.

Change-Id: Ic93b2e67be0c07e27d26ed2c6677c5a0f1b42e07
Closes-Bug: #1279062
2016-01-12 15:50:31 -06:00
You Wei Wang 6214c57540 Trivial: Remove vim header from source files
Change-Id: I98a0cf875839e515be65311962fba173c03c6a56
2016-01-12 23:45:31 +08:00
Jenkins be3604a374 Merge "Move deployed dir from /var/run to /var/lib" 2015-11-12 01:43:15 +00:00
Steve Baker c002854fa4 Move deployed dir from /var/run to /var/lib
Deployments should not be run again when a server is rebooted because
heat will likely not be listening for the deployment signals. This
change moves the deployed directory from /var/run/heat-config/deployed
to /var/lib/heat-config/deployed so that deployed state is persisted
across reboots.

There is migration logic to move the existing files from the old to the
new location, this will only be run on the first run of 55-heat-config
after its package is updated.

Change-Id: I3d305a4ac5b68c29037760682d37e5b9a530828e
Closes-Bug: #1513220
2015-11-11 12:18:41 +13:00
Jenkins 886c79a6b0 Merge "Add test code for software config hook for ansible" 2015-10-13 03:35:42 +00:00
Jenkins 7f3e08d282 Merge "Handle non-zero success codes from Salt" 2015-10-05 20:50:17 +00:00
Randall Burt 10fd46579a Handle non-zero success codes from Salt
Salt does not always return 0 on success so verify actual
task results on non-zero return codes. Also add test for
salt config hook.

Change-Id: Ib848ef27ae29417ca38874d8310bdcd2bc35e2c3
Co-Authored-By: Chris Hultin <Chris.Hultin@rackspace.com>
Closes-Bug: #1483336
2015-10-05 12:24:41 -05:00
Hidekazu Nakamura 6758ace9fb Add test code for software config hook for ansible
Added test code for software config hook for ansible.

Change-Id: I1fa18a8b5f1a2998707be051be516fd44d50f1dd
Closes-Bug: #1472282
2015-10-05 08:14:24 +00:00
Martin Mágr 2636f415b8 Improve handling of Puppet output
Currently the output of Puppet run is written to os-collect-config log only.
If the run gets stuck, we have zero output from it, and have no chance
of guessing where it got stuck. This patch is fixing this issue and also adds
support for running Puppet in debug mode.

Due to big amount of data stdout and stderr in response during debug mode,
both are trimmed so that we won't exceed  max_json_body_size(1048576).

Resolves-bug: rhbz#1242396

Change-Id: Ie92d1714a8d7e59d347474039be999bd3a2b542f
2015-10-05 08:13:17 +00:00
Dan Prince 81c78630fc Add puppet hook option for --tags
Using --tags allows you to run a puppet manifest and only apply
a subset of the catalog. You can specify --tags package for
example to only install packages resources for a given
manifest.

The intent is to use this option alongside of the TripleO docker
work to selectively control what parts of a puppet manifest
get executed in a container.

Change-Id: Ic8b54c89e62cbe5074f256e29e10f59aa2ab0aae
2015-09-11 05:39:52 -04:00
Rabi Mishra 37efe6f243 Use deployment name rather than id for compose project
Latest docker-compose only recreates containers whose
configurationhas changed since they were created[1].
This patch  uses sd 'name' rather than 'id' for the
project name that helps in recreating containers with
the same name after an update. Also changes
docker-compose version to 1.4.0.

[1] https://github.com/docker/compose/releases/tag/1.4.0

Change-Id: Ia9b8621c8785b55551a0660fed0148b15ab4f20c
2015-08-18 13:05:31 +05:30
Graeme Gillies 67c7f150a4 Modified puppet hook to add option to specify modulepath
The puppet hook for heat software-deployments now has the option
to specify a modulepath to use when running puppet. This will
allow users to perform different sofware deployments with different
or even overlapping puppet modules, by specifying the exact path
to source modules from.

Change-Id: I9a07f4468f0b9468635fa74628d5f2f1c2bbe978
2015-07-20 13:35:55 +10:00
Jenkins a6f01c7e0d Merge "Add tests and example template for atomic hook" 2015-06-03 23:14:56 +00:00
Sirushti Murugesan 4a4641a0a2 Upgrade Hacking version
Change-Id: Ib2fc7e0d8e27de2fef341e313e29904502158aa4
Closes-Bug: #1458450
2015-05-25 11:52:29 +05:30
Rabi Mishra 637e6d569f Add tests and example template for atomic hook
Atomic hook can be used with bootconfig to deply containers using
atomic tool in rhel 7.1. This patch adds test and exmaple template
for the hook.

Change-Id: I0f2469225027f3d37c7dd59f85dee8b5aa24a874
2015-05-07 07:56:37 +05:30
Jenkins eb3b82b7d1 Merge "Add env_file support for docker-compose hook" 2015-04-07 21:48:07 +00:00
Rabi Mishra 96898e3824 Add env_file support for docker-compose hook
Added support for `env_file` which can be single file or a list
of files. Use special input 'env_files' for the env_files. These
files will be created by the hook relative to the compose project
directory.

if 'env_file' entries in 'docker-compose.yml' do not exist in the
`input_values` supplied, docker-compose will throw an error as it
can't find these files.

Change-Id: I0dbe80e8c8c56cc680f8ee86b4f34cf3d27533c4
2015-04-07 22:46:47 +05:30
Steve Baker 841ee38a35 heat-config-kubelet hook
This hook uses the kubelet agent from the kubernetes project
to provision containers. The StructuredConfig resource data
represents a pod of containers to be provisioned.

The files have the following purpose:
- extra-data.d/50-docker-images allows an archive file of docker images to
  be included in the dib image
- install.d/50-heat-config-kubelet installs kubernetes for redhat based distros
  during dib image build, along with the required systemd and config files required
  to enable a working kubelet service on the host
- install.d/hook-kubelet.py polls docker images and containers until the expected
  kubelet-provisioned containers are running (or a timeout occurs)
- os-refresh-config/configure.d/50-heat-config-kubelet runs before 55-heat-config
  (and the kubelet hook it triggers). This orc script writes out all pod definition files
  for the pods that should currently be running. Kubelet is configured to monitor
  the directory containing these files, so the current running containers will
  change when kubelet acts on these config changes

Author: Steve Baker <sbaker@redhat.com>
Co-Authored-By: Rabi Mishra <ramishra@redhat.com>

Change-Id: Iabb844c7d8a6f916093c364ad8caa0dbe50df3dd
2015-04-02 08:41:38 +05:30
Rabi Mishra 717246d99a Remove experimental 'heat-config-docker' hook
This removes the experimental docker hook in favour of docker-compose
hook.

Change-Id: I5a9bac4746df4682fb2165a4ad70f668366ffab5
2015-03-17 15:27:43 +05:30
Jenkins 4c1a0408e9 Merge "heat-config-docker-compose hook" 2015-03-16 03:20:36 +00:00
Rabi Mishra 5cbf3ba4a5 heat-config-docker-compose hook
This hook which uses 'docker-compose' to deploy containers.
The StructuredConfig resource data represents a 'docker-compose'
project that can include more than one services/containers.

Change-Id: I63074c51f59893ba4c6500eae2f42fa5bd7ed061
Closes-Bug: #1426223
2015-03-12 15:46:27 +05:30
Steve Baker 08d00b0c41 Start of docker hook unit tests
Other hooks process json then execute commands. The docker hook
makes socket API calls via the docker-py module. For this reason
a different approach has been taken with testing this hook:
- symlink hook-docker.py to the tests package as hook_docker.py
- in the test, mock out the docker import and run main() directly

Change-Id: Ia069b2cc0db71952732dea310a8986b73981b656
2015-02-26 13:19:45 +05:30
Steve Baker f27ef03211 heat-config-notify support deploy_signal_verb
The URL for deploy_signal_id is called with POST by default, however some
signals need to be called with PUT (specifically signals backed by swift
objects).

This change uses the value of deploy_signal_verb for POST or PUT, using
POST by default.

Change-Id: I8c83fa34cad9b1e91abcfc7e26e04b21cdc9bde4
Partial-Blueprint: software-config-swift-signal
2015-02-18 11:27:55 +13:00
Steve Baker 25c4759fe0 Break out signalling heat-config-notify command
Currently signalling heat is done in a chunk of python at the end
of 55-heat-config. This change moves the signalling to its own
command heat-config-notify, which can be called from 55-heat-config
or anything else which wants to signal heat.

This change also adds proper test coverage to the signalling logic.

Change-Id: I6ba7468b46ca8cfad1e58207cd3f814a178ff6f1
2014-12-12 14:35:07 +13:00
Steve Baker 2b33ca539f Write each deployed config json to file
Previously 55-heat-config assumed that executing a hook with some
config is an idempotent operation, so it made no effort to prevent
a hook being invoked with the same config multiple times. This means
that whenever *any* deployment metadata changes *all* configs are
run against their hooks again. This would be undesirable for
non-idempotent configs, or configs which are expensive to execute.

This change writes out the config json to files in
/var/run/heat-config/deployed and uses the presence of this file to
determine whether that config has been deployed already. This also
improves the debugging experience as a single hook execution can be
triggered manually by running:
  /var/lib/heat-config/hooks/<hook> < /var/run/heat-config/deployed/<cid>.json

Closes-Bug: #1376008
Closes-Bug: #1365302

Change-Id: Id2d2f623508be3049a7db8a39f5444ccac9257d6
2014-12-12 14:35:00 +13:00
Jenkins bfab94dd24 Merge "heat-config-puppet: support hiera" 2014-12-11 22:05:30 +00:00
Dan Prince 94bd31e45e heat-config-puppet: support hiera
Updates the puppet hook so that we support using Hiera in addition
to the existing Facter based input mechanism. Hiera provides
a more flexible way of dealing with puppet parameters and
seems to be prefered in the Puppet community as well.

Use of the Hiera data will also require an additional
'hiera' element which will probably live in the
triple-puppet-elements tree.

Change-Id: I497f2d2286025e48e42691bfe178fc9c491928ea
2014-12-11 15:29:29 -05:00
Steve Baker dc84c21e5f Fix file exists asserts
assertTrue should have been assertThat

Change-Id: I9b0685abc074525461c57df1d1d9afdf9d3bdd73
2014-12-11 11:05:52 +13:00
tengqm 793c1cdea6 Enable script hook to handle Json input
This patch adds conversion of Json type input into a string so that it
can be consumed by scripts (e.g. Python or Bash).

Change-Id: I715819dc8e0c1c9119b544330d5b0c77e9c2f924
Closes-Bug: #1392802
2014-11-21 13:05:21 +08:00
Steve Baker 79b6885081 Unit test of script hook
This test asserts the following when the script hook is invoked
with test data:
- Expected env variables are set
- Script contents matches the fake config tool contents
- Script is invoked with no arguments
- Written output files result in output values being set
- Script responding with a failure returncode propagates to the
  response

Change-Id: I1c32ec89b1ce16c25e3a29ab36e016cca5ff7835
2014-10-13 12:19:06 +13:00
Steve Baker 220d5bdac9 Unit test of puppet hook
This test asserts the following when the puppet hook is invoked
with test data:
- Expected FACTER_* env variables are set
- Puppet is invoked with the expected arguments
- Written output files result in output values being set
- Puppet responding with a failure returncode propagates to the
  response

Change-Id: I987c9575bd51f53054c5f8e6c332aaa60a4a8f0c
2014-10-13 12:19:06 +13:00
Steve Baker d86eec6b73 Trigger cfn-init via script rather than lib
The current cfn-init software-config hook doesn't work at all
since cfn_helper is installed in a venv, not in site-packages.

This change switches to writing out metadata to
/var/cache/heat-cfntools/last_metadata and invoking cfn-init.

/var/lib/heat-cfntools/cfn-init-data cannot be used since that is
already populated with all boot metadata, which may still be used
by os-collect-config bootstrapping.

Change-Id: I7252a6f12223613b55b4b6417383673faa0d52b3
Closes-Bug: #1321513
2014-10-13 12:19:06 +13:00