25 Commits

Author SHA1 Message Date
Riccardo Pittau
8111475eb0 Use Werkzeug modern version
Request class from Werkzeug now includes json capability by default.
See [1] and [2] for more info.

[1] 2cd4fa9484
[2] 7b52ecd8f3

Change-Id: I3c74b26ef4aff07c371364203a5b39c658b552a7
2022-04-14 10:47:06 +00:00
Dmitry Tantsur
c585603ee6 Log configuration options on start-up
This is very convenient for debugging and is something ironic and
ironic-inspector already do.

Register SSL options earlier so that they're accounted for.

Change-Id: I56aca8eec1dfeb065ac657452a7076a9e3d17cc3
2020-11-11 16:38:10 +01:00
Dmitry Tantsur
021e0a6a46 Generate a TLS certificate and send it to ironic
Adds a new flag (on by default) that enables generating a TLS
certificate and sending it to ironic via heartbeat. Whether
ironic supports auto-generated certificates is determined by
checking its API version.

Change-Id: I01f83dd04cfec2adc9e2a6b9c531391773ed36e5
Depends-On: https://review.opendev.org/747136
Depends-On: https://review.opendev.org/749975
Story: #2007214
Task: #40604
2020-09-11 17:46:52 +02:00
Jay Faulkner
1d11f0b7dd If listen_tls is true, enable TLS on wsgi server
This change enables operators to set [DEFAULT]listen_tls to
true configure IPA to be host its WSGI server over TLS using
existing SSL support in oslo.service.

In addition to configuring this in IPA, a deployer will need to
also set [ssl]cert_file, [ssl]key_file, and optionally
[ssl]ca_file in their ipa config, in addition to embedding those
files into the IPA ramdisk in order for this to be functional.

In order to make this change work, we also need to monkey patch
socket library early, or else oslo.service will end up passing an
unpatched socket to the eventlet wsgi server, which causes
deadlocks.

Change-Id: Ib7decae410915f3c27b045ee08538c94d455b030
2020-09-02 16:07:42 -07:00
Jay Faulkner
7d0ad36ebd Make WSGI server respect listen_* directives
The listen_port and listen_host directives are intended to allow
deployers of IPA to change the port and host IPA listens on. These
configs have not been obeyed since the migration to the oslo.service
wsgi server.

Story: 2008016
Task: 40668
Change-Id: I76235a6e6ffdf80a0f5476f577b055223cdf1585
2020-08-31 14:37:38 +00:00
Julia Kreger
af5f05a0ee Agent token support
Adds support to the agent to receive, store, and return
that token to ironic's API, when supported.

This feature allows ironic and ultimately the agent to
authenticate interactions, when supported, to prevent
malicious abuse of the API endpoint.

Sem-Ver: feature
Change-Id: I6db9117a38be946b785e6f5e75ada1bfdff560ba
2020-03-12 10:35:17 -07:00
Julia Kreger
8aa9b79c46 Stop the API so rescue can exit and succeed
The change in frameworks with the API changed the overall execution
behavior from single threaded serialized execution threaded to
multithreaded through eventlet.

But we signaled ourselves to wait for the API to stop, but never
actually stopped the API.

As setting the flag to stop the API is a hard notification that
the API must now exit, there is no reason to wait and block exit,
hence the simple nature of this change.

Now the threads should exit, IPA should exit, and rescue should
ideally work.

Change-Id: I3faf2d169d4edac6a2321f8649bb9ce478885ea1
Story: 2006998
Task: 37768
2019-12-07 09:45:32 -08:00
Dmitry Tantsur
f1b2df908a Replace WSME and Pecan with Werkzeug
WSME is no longer maintained and Pecan is an overkill for our (purely
internal) API. This change rewrites the API in Werkzeug (the library
underneath Flask). I don't use Flask here since it's also an overkill
for API with 4 meaningful endpoints.

Change-Id: Ifed45f70869adf00e795202a53a2a53c9c57ef30
2019-12-04 16:50:47 +01:00
Riccardo Pittau
ca7a46b113 Stop using six library
Since we've dropped support for Python 2.7, it's time to look at
the bright future that Python 3.x will bring and stop forcing
compatibility with older versions.
This patch removes the six library from requirements, not
looking back.

Change-Id: I4795417aa649be75ba7162a8cf30eacbb88c7b5e
2019-11-29 10:18:14 +01:00
zhangshj
d45650f086 Replacing the HTTP protocal with HTTPS
Change-Id: I9791b6781158c0ddebda636daeea39665b483dd6
2018-12-25 19:51:40 +08:00
Julia Kreger
3164053f08 Fix gate and bump CoreOS version to latest stable.
Increases the amount of ram for CoreOS IPA to 2GB
as the base CoreOS image is now 310MB.

Bumped CPU count for CoreOS runs to 2 CPUs as the
concurrency helps boot times for the CoreOS ramdisk.

Adds netbase, udev, and open-iscsi to debian jessie container
as they are no longer present in the default container.

Explicitly set path variable for execution in the debian
container as udevadm is in /sbin, and we may not have
/sbin on the path that is passed through to the
chroot.

Also fixed new pep8 test failures.

Story: #1600228
Task: #16287
Change-Id: I488445dfd261b7bca322a0be7b4d8ca6105750a3
2018-05-10 15:50:05 -07:00
Vu Cong Tuan
e6033e733e Remove /ironic-python-agent/api/app.wsgi
/ironic-python-agent/api/app.wsgi is an empty file.
As suggestion from John L. Villalovos, we probably should delete it.

Change-Id: I695aca42b76dfad1b74418c05a48c5cba3b7d71e
2017-12-14 14:20:14 +07:00
John L. Villalovos
64bde74824 Update version of flake8-import-order package
Use latest version of flake8-import-order package, like we do in
openstack/ironic

Fix two issues detected by new version.

Change-Id: Idb8f0fd79c3d6b34611288f77948d042cd837806
2017-12-08 14:17:56 -08:00
Derek Higgins
b4e41e2dd2 Agent: Listen for connections on both IPv4 and IPv6 ports
Allow connections if deploying over a IPv6 network.

Change-Id: Ied2f6be4aa4d1a70524df1df3506e596f6926e5b
Closes-Bug: #1650539
2017-01-19 15:24:11 +00:00
Josh Gachnang
fd874652e3 Add metrics support to IPA
This utilizes the new metrics support in ironic-lib to allow the agent to
report timing metrics for agent API methods as configured in ironic-lib.

Additionally, this adds developer docs on how to use metrics in IPA,
including some caveats specific to ironic-lib.metrics use in IPA.

Co-Authored-By: Jay Faulkner <jay@jvf.cc>
Co-Authored-By: Alex Weeks <alex.weeks@gmail.com>
Change-Id: Ic08d4ff78b6fb614b474b956a32eac352a14262a
Partial-bug: #1526219
2016-08-03 11:24:54 -07:00
Sam Betts
f58f7b9a07 TinyIPA: Precompile python code for faster load
This patch adds code into the tinyipa build process and IPA itself to
allow the required python code to be PYTHONOPTIMIZE precompiled into
pyo files, this speeds up IPA startup time in a nested virt by 50%.

Change-Id: Ib60c420719ea52a602c1752b572d3b217c2cefc7
2016-05-11 18:58:57 +01:00
Mario Villaplana
3d097f5fdc Fixes incorrect description URL
A GET to /v1 in the API returns a link to a URL for a repository that is no
longer maintained. This commit changes the link to point to the correct
documentation.

Change-Id: I8779cd1840627ff8759527b7514306293682aaae
2015-09-15 21:05:19 +00:00
Josh Gachnang
59281ecda8 Improve IPA logging and exception handling
Debugging the agent is a huge pain point. Tracebacks are rarely logged,
error messages are often only returned via the API, and lack of
info logging makes it hard to determine where some failures occur.
Some errors only return a 500 with no error message or logs.

Change-Id: I0a127de6e4abf62e20d5c5ad583ba46738604d2d
2015-07-28 09:37:43 -07:00
Jay Faulkner
8bad5bbac3 Fix Sphinx Autodoc WARNING/ERROR in docs build
The docstrings here were all giving WARNINGs or ERRORs during the docs
build, and were generally making unappealing looking developer
documentation. I corrected the syntax and did what was neccessary to
make the build come out clean.

Change-Id: I74b00a7f125770b0468cff3bdf26d0d52cd054d7
(cherry picked from commit c0921cdff372ce1fd6df1c4ab4eb5463e2cba0e4)
2015-03-31 16:22:57 -07:00
Jim Rollenhagen
a524db83b6 Add docstrings for api/ tree
Does what it says.

Partial-Bug 1367915

Change-Id: Id1a718d652f6d98e6acb1d667f42d9c3cc82aef5
2014-09-22 07:31:09 -07:00
Chris Behrens
ab46681e33 Fix wait argument on POST
Its type was not declared. Adds tests for this.

Change-Id: Iba05ce38f7548cc8400ac78493ef16b5e69905bb
2014-04-21 00:05:54 -07:00
Jim Rollenhagen
3c1d52cbb1 Use # instead of """ for copyright blocks
Reformats copyright messages to be comments rather than
docstring-style blocks.

Change-Id: I4d863f53b67bb49d03bda0952b9e6179b6d23c59
2014-04-10 07:14:06 -07:00
Alexander Gordeev
aee1555156 Get rid of modes. Introduce pluggable extensions
Allow multiple extensions to be loaded by switching to ExtensionManager
from stevedore. Remove any reference to modes.

Change-Id: Ic160478625226b4dd17bd68b3d37f3b05823e519
2014-03-27 17:28:57 +04:00
Josh Gachnang
5914e36b30 Replacing teeth/overlord with ipa/ironic 2014-03-19 16:19:52 -07:00
Josh Gachnang
b30d345c2e Renaming to IPA 2014-03-19 15:50:43 -07:00