openstack-ansible-plugins/tests/test-lookups.yml
Jean-Philippe Evrard 8bfffe39cf Add Packages file parsing lookup
This is a lookup in case you need to parse a ubuntu repo Packages file
for a list of packages. It's useful in osa if you want to have a mirror
of an ubuntu repo, and output a list of its packages, with their
location and checksum.

You can use the output dict to feed another tool (for example
downloading with aria).

Change-Id: I10ba72f0b64267ae6afe57317e135d782445e934
2017-03-27 11:43:23 +00:00

41 lines
1.7 KiB
YAML

---
# Copyright 2017, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# (c) 2017, Jean-Philippe Evrard <jean-philippe.evrard@rackspace.co.uk>
- name: Test lookups
hosts: localhost
connection: local
gather_facts: no
tasks:
- name: Ensure Package list contains the files listed in Package
set_fact:
packages_dict: "{{ lookup('packages_file', playbook_dir ~ '/files/Packages') }}"
- name: Validate that Filename, MD5sum, SHA1, SHA256 and Version are properly generated
assert:
that:
- packages_dict['0ad']['Filename'] == "pool/main/0/0ad/0ad_0.0.16-2~ubuntu14.04.1_amd64.deb"
- packages_dict['0ad']['MD5sum'] == "7e5f2ba5e1a95e47753eeb962af32e26"
- packages_dict['0ad']['SHA1'] == "3cf898d4595092daa274e6cd8d9afd0332b0afbe"
- packages_dict['0ad']['SHA256'] == "f4602a90a305abeacb4a48bbfd7d609aa7cbb3ed2ab9127ae30ef64a4be88378"
- packages_dict['0ad']['Version'] == "0.0.16-2~ubuntu14.04.1"
- name: Validate that a provides package is listed as a package too
assert:
that:
- packages_dict['aide'] is defined
- packages_dict['aide-binary'] is defined
- packages_dict['aide'] == packages_dict['aide-binary']