Commit Graph

102 Commits

Author SHA1 Message Date
Dmitriy Rabotyagov d9df50f4e3 Retire pip_install role
As repo_build role has been succesfully replaced with
python_venv_build role, we have no need in it's futher maintaining and
releasing.

Depends-On: https://review.opendev.org/717715
Change-Id: Ibf9ce1d602c5cfa9ed7431ca37de02df3335b36a
2020-04-06 14:27:00 +00:00
Logan V 2f586ab435 Fix bug finding pip install method
An fatal error results due to the install script search '.find' not existing
on the dict result of the install script check task. Instead the .find should
be searching the stdout key of the install script check task results dict.

Ie. .find() is a string search, not a dict search.

The following fatal error results when using .find() on the dict:

The conditional check 'pip_install_script.find('get-pip.py') != -1' failed.
The error was: error while evaluating conditional (pip_install_script.find('get-pip.py') != -1): 'dict object' has no attribute 'find'

Change-Id: I4b929d58057b3d249007fe7c563439ab65faf4ce
2018-12-02 13:59:11 -06:00
Jean-Philippe Evrard 039d884e29 Ensure get-pip cannot be modified
We don't ensure the permissions of the fetched file on the
download location. Sadly /tmp is a known place where users can
write files.

This is a problem, as a potential race condition could appear,
where get-pip is modifiable on /tmp/ folder by another user,
leading to privilege escalation.

Change-Id: I041db3412e228efe8a0d9a87f4cfba206482c729
2018-08-17 16:24:40 +00:00
Jesse Pretorius 79e3480a68 Allow the role to only configure pip, not install it
There are times when you may wish to just configure pip,
not install it. This adds a flag to enable that option.

Change-Id: Ibaa3c0b6b323f22dbd640562362106166bbc0a0a
2018-08-01 15:48:03 +01:00
Zuul 722470da02 Merge "Ensure the fallback uses the same install method" 2018-07-19 11:18:21 +00:00
Jean-Philippe Evrard b6024a9184 Ensure the fallback uses the same install method
We have a test to ensure the install method of pip is from distro
or get-pip. But if an issue appeared in the first task, the
fallback method will automatically fallback to get-pip instead
of fallback to the isolated version of the pre-defined CLI.

This should ensure consistency by not using get-pip if it's not
needed.

Change-Id: I7aa4056ffb9bc2162f0960e74b6458bcbffa141f
2018-07-19 12:19:53 +02:00
zhulingjie 97a930fbef Remove the unnecessary space
Change-Id: Id2c18c8e1f3d3e0268b6d2f2bc8722ff55d43739
2018-07-11 23:03:17 -04:00
Jean-Philippe Evrard 914fbc44cb Fix usage of "|" for tests
With the more recent versions of ansible, we should now use
"is" instead of the "|" sign for the tests.

This should fix it.

Change-Id: I950916695929d35dbf4606f4ef33f5ae559118c5
2018-07-12 17:02:41 +02:00
Markos Chandras fe5d99228b tasks: main: Fix conditional for PIP script
The conditional must search the 'stdout' item to find the string we
are looking for.

Change-Id: I469116ffbc11160122879b6f60800c63908fec0f
2018-05-24 08:41:15 +01:00
Markos Chandras 40373daf7e tests: Do not always fetch the get-pip.py script during tests
Since we are testing the idempotence of this role, we shouldn't
fetch the get-pip.py script on every iteration so we set the variable
to 'false'. Moreover, we bump the PIP version to 9.0.3 since this is
what is currently being deployed on the hosts. Finally, get-pip.py
uses --force-reinstall by default which means that everything is being
reinstalled all the time and this breaks idempotence. We can fix that by
simply checking if a suitable version of PIP is installed and then use
it to do a proper upgrade.

Change-Id: I998182eca9851d2cc745930fc73ca37bfefd0951
2018-04-20 13:50:21 +01:00
Matt Thompson 5a99262155 Specify defaults for pip_install_upper_constraints
If this role is run without having pip_install_upper_constraints set
then you'll get a failure stating that pip_install_upper_constraints is
undefined.

This patch simply adds the default filter when referencing
pip_install_upper_constraints, which seems to be the pattern used in
openstack-ansible's utility-install.yml playbook.

Change-Id: If1b68fb21e0eb8f2f8c33a6bec952c2972e3e5e3
2018-04-03 15:02:13 -04:00
Zuul f2e2d921a5 Merge "Use constraints with get-pip.py" 2018-04-02 15:26:53 +00:00
Logan V ff2b9fa21d Use constraints with get-pip.py
Presently no constraints are passed to get-pip.py when installing
pip, so we just receive the latest version of pip/setuptools/wheel
everywhere without respecting global-requirement-pins or any other
constraints.

To avoid this we'll pass pip_install_upper_constraints args to
get-pip.py by default.

Change-Id: I32603fd34b60183607c6bd9653c36432cbe6b07a
2018-04-02 15:06:38 +00:00
Jesse Pretorius 3133ee8384 Remove pip_required_pip_packages var and related tasks
The pip_required_pip_packages variable was introduced in
order to facilitate installing extra packages required
for SNI support. In Pike these extra package installs
were removed due to interference with distribution
packages installed, and the distro package installation
for this support was deemed better.

This variable and the related tasks therefore no longer
server any function and should be removed.

Change-Id: I76fb9ae324ff69e8fc8b23f7b610d2aca48d0949
2018-03-11 08:59:11 +00:00
Jesse Pretorius f9d65b184f Remove pip_lock_to_internal_repo variable
The ability to lock the pip configuration down has
now been extended so that it is possible to implement
a different index and to use find-links to achieve the
same goal.

The only replacement implementation could be to disable
the setting of an index if one wanted to *only* use
wheels, but that is unnecessary in OSA builds as we are
able to set the build to only use a specific set of
wheels through the pypiserver on the repo container.

As such, this variable has become useless and unused.
This patch therefore removes it.

Change-Id: If472c845036ab904ffc15ca7201ae68d282c1be0
Implements: blueprint python-build-install-simplification
Signed-off-by: Jesse Pretorius <jesse.pretorius@rackspace.co.uk>
2018-02-18 15:49:16 +00:00
Major Hayden 13a52e2669
Change include: to include_tasks:
This removes the warnings in Ansible 2.4+.

The patch almost removes the "static:" argument which is no longer
used by Ansible.

Change-Id: I267a7cd17b0af7c1c59a166bb505875167b0ad81
2018-02-15 07:58:09 -06:00
Kevin Carter 0f18e40fb6
Set pip to use the pypi-server when locked down
The repo server now hosts a native pypi-server. This new server allows
us to use a native pip install instead of our existing "find-links"
approach. Moving to the native pypi server is not only faster, it is also
more scalable. This change agments our existing wheel lockdown by
setting the index to our new pypi-server and defining an online
constraint file in the pip.conf.

Additional checks have been set within the configuration task file so
that we're confirming pip can be locked down prior to setting the
pip.conf file which can, and will break a deployment if configured
incorrectly. These tasks will only fire when the option
`pip_lock_to_internal_repo` has been set to "true" making them a no-op
by default.

Change-Id: I2f9aaa1aecf7d03a833f60d483de364d6a6d64fa
Depends-On: Icc2ee264fc213b258642b5393dd78b1b26ef0542
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-02-10 11:13:35 -06:00
Jean-Philippe Evrard a6216fa4a8 Cleanup pip install role
With the change in openstack_hosts repo, we can remove
duplications in the pip_install role.

Depends-On: I541287f906a143ed79553c69e1a9e39ee38dc8dc
Change-Id: I1afc143579689a690eddbbf2423a4cd0501f9688
2017-12-01 03:22:36 +00:00
Zuul e036e6d1cc Merge "Add ability to disable implementing pip.conf" 2017-11-28 13:54:32 +00:00
Jesse Pretorius 5f566318d5 Add ability to disable implementing pip.conf
On something like the repo server we do not want to
change the default pip settings so that we allow
the global pip.conf or default pip settings to do
the right things.

Change-Id: I7bd31f2d89d3fe9d48e32c79ddef7a8ef1392eb7
2017-11-24 16:53:48 +00:00
Jesse Pretorius 4e7e23f6e9 Remove selfcheck.json
The file selfcheck.json has no discernable purpose,
so it is removed. The file pip-selfcheck.json is
automatically created by pip and used to track
when last it checked if it's on the latest version.

The tags implemented in the role are also corrected
to ensure that the placement of the pip.conf file
is considered a 'config' task, not an 'install'
task. The sub-tags are removed as they are unnecessary.

Change-Id: I53ad3a9c50071a34286f2351f5f245f272c07638
2017-11-24 16:48:02 +00:00
Guoqiang Ding 58c5209b70 Add retry on the step of installing repo key
This task runs failed sometimes. Add retry to ensure pass it.

Change-Id: I1b838b3c4de50acd4dec0e338bf9815116f7e118
Closes-Bug: #1732626
2017-11-16 16:53:54 +08:00
Major Hayden 132c6c15e5 Copy RPM keys into correct place
This patch copies the RPM keys into /etc/pki/rpm-gpg/ and
maintains their original names. This should allow the LXC
cache process to copy over the keys.

Depends-On: Icfd7e2b110541f85bf98efc384a9698dbbbd9682
Change-Id: I8acf7237c1bcbf7dc98d08aa5907972b69574bba
2017-10-26 12:09:23 +00:00
Jean-Philippe Evrard 8d8a578280 Vendor in the RDO GPG keys to install
This way we avoid all networking failures.

Change-Id: I07b04301629e3b2a176c210ed7989f8d699b7e8c
2017-10-25 15:55:39 +00:00
Major Hayden 9372b42afa
Use sks-keyservers GPG server as primary
This patch switches the order of keyservers since the
sks-keyservers server is more reliable than CentOS'
default.

Closes-Bug: 1723440
Change-Id: I9e18e518cf2baeb52f01531b96811cb1e4393cbc
2017-10-13 09:20:35 -05:00
Major Hayden eb1b745781
Fix missing space in RPM command
This patch fixes a missing space in the RPM command that
imports GPG keys.

Change-Id: Ib8cd28138f1c9ab446e50cf9076edbdfdee1f2c7
2017-09-25 16:24:44 -05:00
Jenkins e6d1ef46b7 Merge "Remove unneeded task" 2017-09-20 13:45:15 +00:00
Jimmy McCrory 7a2e2becb1 Remove unneeded task
The task to remove extra files and directories that the pip_install role
used to deploy has been included in the Pike release and was backported
through Newton. They definitely shouldn't exist in Queens and the task
to remove them shouldn't be required any more.

Change-Id: Ib514097f15a7560a5292798f8c0821f6a31c51c5
2017-09-19 15:13:00 -07:00
Major Hayden a32869fc32
Optimize pip_install for CentOS
This patch does quite a few things to improve the performance of the
CentOS tasks:

1) Configures RDO repos as repositories rather than reinstalling an
   RPM each time.
2) GPG keys are only installed if they're needed.
3) Yum repo configs are carefully modified if they already exist
   which avoids removing deployer configurations.
4) Repo priorities are now set in one shot.

Change-Id: I0fe7f7ee0a9b580280c59f950277d2b9474e4210
2017-09-19 11:20:47 -05:00
Jenkins 26a5868fff Merge "Flatten the role task includes" 2017-09-15 19:36:39 +00:00
Major Hayden d9ba18ec6a
Keep yum repo cache
This patch ensures that the yum repo cache is kept and not
redownloaded constantly.

Change-Id: I30f8b941fec6909a4b9a90dfc24586ff514eb62c
2017-09-14 16:57:22 -06:00
Jesse Pretorius 6d60482158 Flatten the role task includes
Currently there are several layers to work through
when following what happens in the role. This is
confusing and somewhat frustrating.

This patch hopefully reduces the layers to a more
sane set.

Change-Id: I5f1a8c8465fa27b01342315dac5db0046cfb2e18
2017-09-13 15:09:21 +00:00
Jenkins 75ee1e18e5 Merge "Use RDO Pike repository" 2017-09-07 16:41:24 +00:00
Markos Chandras 0544c622b2 SUSE: Add ability to configure external mirror for openSUSE
Allow deployers to choose a specific mirror by setting the
'pip_install_opensuse_mirror_url' variable

Change-Id: I4f4cc284ab7d1c3378e01737f9fade3afe251824
2017-09-07 10:22:44 +01:00
Major Hayden fabe518a67
Use RDO Pike repository
This patches switches CentOS over to the new Pike RDO repository.

Closes-Bug: 1715239
Change-Id: I359c214e9b5d0d31b0b84d4d74d2d8bc0f872f8a
2017-09-05 15:48:24 -05:00
Major Hayden 3500a26919
Allow override of RDO repo baseurl
This patch allows deployers to set pip_install_centos_mirror_url
and override the default RDO repository (mirrors.centos.org).

Change-Id: I7b0dd5d14c82a74be955071e638c122ffb45ab31
2017-08-21 07:35:28 -05:00
Major Hayden a4209580d9
Rename package install task
The majority of the other roles use "Install distro packages"
as the name for the package installation task. This patch renames the
task in the pip_install role to match.

This will help when we try to profile the CI jobs to see which tasks
are taking the longest time to complete.

Change-Id: I353a4da01d7f99ccc33d9a0e4a494e9b43438da4
Signed-off-by: Major Hayden <major@mhtx.net>
2017-08-07 14:50:41 -05:00
Major Hayden 86baf71d79
Add dnf support
This patch adds dnf support on CentOS without impacting existing
deployments that use yum.

Implements: blueprint centos-and-dnf
Change-Id: Ie583562b3c671389297ed5b0d5627f1b72ca286e
2017-08-02 11:22:04 -05:00
Jesse Pretorius (odyssey4me) 89374c70bb Revert "Make initial pip install use constraints"
This reverts commit 35809a2fff.

Unfortunately this is trying to force a downgrade for
gating which results in failures. I'll need to re-work
this to do things a little differently.

Change-Id: I8d29d5f17c87cfd88847734ab9d96354b7f1706d
2017-07-20 13:31:06 +00:00
Jesse Pretorius 35809a2fff Make initial pip install use constraints
The get-pip script allows the use of constraints now,
so to provide the maximum protection we should use
it. This also reduces one of the places where we need
to do package pinning.

Change-Id: I4618615b84618401359b5c5c6f51512e6c9a697e
2017-07-14 14:28:45 +01:00
Markos Chandras 26432f4f95 SUSE: Add the Cloud:OpenStack:Ocata repository
The OBS Cloud:OpenStack:Ocata repository contains most of the necessary
packages to deploy an OpenStack cloud so it's best to have it installed
as soon as possible.

Change-Id: I131558011d056da63f03a6e7d8276d93c594c9aa
2017-06-06 15:16:48 +01:00
Jesse Pretorius dcb5c7548a Clean up extra tags
Change-Id: Ia4b15547ccb261f46fcf7552e33e23fdd3a561c8
2017-05-04 07:27:26 +01:00
Jesse Pretorius 843673591f Ensure that all repos are configured properly
It appears that yum-config-manager does not properly
configure all the repositories reliably when trying
to give it a bunch of them to do at once.

This patch sets each repo to be enabled and have the
priority set one at a time.

Change-Id: Ia56d7344572a0addfd4fd5c93832dc66f630e93d
2017-05-03 15:15:38 +01:00
Jenkins 1db27456b9 Merge "Pass list for package install" 2017-04-25 11:08:02 +00:00
Marc Gariepy 0aac130373 CentOS make sure epel is enabled.
Change-Id: I184b5f6dfc136da2080ad6336f7e7debe91b6dce
2017-04-24 14:57:20 -04:00
Major Hayden 1a9f2124ef
Pass list for package install
Ansible 2.x allows for packages to be passed as a list directly to
the `name` argument. This patch moves the EPEL packages into a list
and converts all package install tasks to pass a list directly
rather than looping over a list with with_items.

This should speed things up a bit. ;)

Change-Id: I0c185ad9d2a69f5625309d77a30536d2d373b2b5
2017-04-24 07:44:06 -05:00
Jesse Pretorius 508ed6aaa2 Optimise apt cache update task
The update of the apt cache and the package installation
can all be handled in a single task by providing the
package action plugin with the right parameters. This
removes an extra task to optimise execution.

The minimum Ansible version is raised to 2.2 due to a
known bug [1] in Ansible's apt module which does not
update the cache properly if the cache update and the
install are combined in a single task.

[1] https://github.com/ansible/ansible-modules-core/issues/1497

Change-Id: I281016d1e836705afec1579192647ed7c6a7e7cd
2017-04-21 16:55:14 +01:00
Markos Chandras f5cd194ad6 SUSE: Add missing pre_install_zypper file for SUSE
Add missing pre_install_zypper file to SUSE which is required
by the pre_install.yml play. This also renames the SUSE variables
file to suse-42.yml to match the rest of the distributions.
Finally, the run_tests.sh, Vagrantfile and bindep.txt files are
synced with the openstack-ansible-tests repository.

Change-Id: I2fb733f5818098486e26ca7fb2ac015f02e3aa44
2017-04-10 23:16:25 +01:00
Jimmy McCrory 289531e46b Enable idempotence test
Tasks involved in the online install of pip have been made idempotent
and the idempotence test has been enabled.

The selfcheck.json file will only be written if it does not already
exist. Blocks have been added to tasks that have a fallback if they
fail. Tasks that run commands to install or download pip packages now
check stdout for success messages to determine if they should be marked
changed.

Change-Id: I0d440efd4d95420f6f43316f5e0242b8884293c8
2017-04-05 12:19:20 -07:00
Jesse Pretorius 793ae4d013 Resolve user_external_repo deprecation warnings
Warnings about 'user_external_repo_keys_list' and
'user_external_repos_list' being undefined are
confusing.

Closes-Bug: #1670021
Change-Id: I2fe78300dd04066515f4c5b175d56cc1a6628c9d
2017-03-29 11:37:48 +00:00