Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

OCS metadata server

Project description

Metadata Server
===============

Serves pimouss metadata using its own IP address as authentication token.

::

$ curl http://169.254.42.42


Development
-----------

Standalone API::

$> pip install -e .
$> OCS_SETTINGS=conf/dev.yaml ocs-api-metadata

Run test::

$> pip install -e .
$> pip install tox
$> tox


API Routes
----------

- `GET /conf` or `GET /conf?format=json`: get instance configuration: name,
public IP address, SSH public keys, organization details, volumes infos, ...
The default format (`?format=sh`) outputs a response that can be sourced in a
shell.

- `PATCH /state`: update instance state: kernel_started, booted, .... The state
is used to know where the problem comes from in case the boot fails.

- `GET and PATCH /user_data`: user data is a key/value store related to the
server, used to store anything (text, small binary blobs, ...).
To prevent non-root users from accessing this endpoint, the local port making
the request must be below 1024.
This endpoint is notably used by our images to store SSH server fingerprints
(`/user_data/ssh-host-fingerprints`).

- `GET /ipxe`: our x86 nodes (bare metal and VPS) boot on iPXE which retrieves
its configuration through this endpoint.

Configuration
-------------

If `run-in-devcker` is defined to 1 in the `api-metadata` section of the
configuration file, then the /state route will honor `X-Forwarded-For`.

ChangeLog
=========

1.2.7 (2019-02-06)
------------------

* Fix GPU: use real commercial name (RENDER) instead of the internal name (GPU).

1.2.6 (2019-01-30)
------------------

* Dummy release

1.2.5 (2019-01-30)
------------------

* Add support to boot GPU
* Remove process-dependency-links
* Try to fix dependency issue by adding `ocs.object_store.sqlalchemy` which is a sub-dependency, pinning world-backend+api-account and moving SQLAlchemy to tests only

1.2.4 (2018-10-09)
------------------

* Fix PEP8

1.2.3 (2018-10-09)
------------------

* Handle rescue boot type
* Fix/improve tests :
** Force pylint 1.x in tox.ini (to fix jenkins tests)
** AM-36 Change test to use token's secret
** Add missing config for api-task
** Check status_code before reading body

1.2.2 (2018-05-04)
------------------

* Add START offers

1.2.1 (2018-01-23)
------------------

* PEP8, to make Jenkins happy.

1.2.0 (2018-01-22)
------------------

* Add version in root endpoint.
* Fix healthcheck.

1.1.1 (2017-09-07)
------------------

* Do not instanciate Flask application at each request. SCW-6.

1.1.0 (2017-07-21)
------------------

* Expose bootscripts.

1.0.7 (2017-04-25)
------------------

* Remove voluptuous dep.

1.0.6 (2017-04-25)
------------------

* Specific name for the initrd.
* Specific serial device for ARM64.

1.0.5 (2017-03-15)
------------------

* Fix unittests

1.0.4 (2017-02-02)
------------------

* Support of new commercial type.

1.0.3 (2016-11-29)
------------------

* Add default ``isort`` configuration.
* Add default ``bumpversion`` configuration.

1.0.2 (2016-06-24)
------------------

* Do not install pre-released packages. Refs SN-412.

1.0.1 (2016-04-25)
------------------

* Fix unittests.

1.0.0 (2016-03-25)
------------------

* Adapt /ipxe to the new compute API format for bootscripts.
* iPXE template: do not generate the "initrd" statement if there's no initrd
attached to the server. Do the same for kernel (even if a server *must* have
a kernel set).

0.10.11 (2016-03-22)
--------------------

* iPXE: in case of error during kernel/initrd download or boot, wait a few
seconds before rebooting to let the serial console's viewer understand what's
going on.

0.10.10 (2016-02-16)
--------------------

* Update VM cmdline (remove all the unused TTYs).

0.10.9 (2016-02-09)
-------------------

* Fix unittest.

0.10.8 (2016-02-09)
-------------------

* Fix device name in VM is vda.

0.10.7 (2016-02-02)
-------------------

* Fix unittest.

0.10.6 (2016-02-02)
-------------------

* Append root for specific commercial type.

0.10.5 (2016-01-06)
-------------------

* Replace LINUX_COMMON by host specific options in ipxe view.

0.10.4 (2016-01-05)
-------------------

* Expose ipv6 property and extra networks.

0.10.3 (2015-12-15)
-------------------

* Freeze sqlalchemy version because of a regression in joinedload of polymorphic entities

0.10.2 (2015-12-04)
-------------------

* iPXE configuration: reboot if the kernel or the initrd download fails.
* Output server commercial type property.

0.10.1 (2015-11-04)
-------------------

* Fix packaging: add api_metadata/views/templates/* to package data.

0.10.0 (2015-09-19)
-------------------

* Create route /ipxe to generate the iPXE configuration of suchards.

0.9.3 (2015-10-12)
------------------

* Fix unittests to work with latest cp backend.

0.9.2 (2015-09-24)
------------------

* Fix error message.

0.9.1 (2015-09-24)
------------------

* Remove the useless variable X_FORWARDED_REMOTE_PORT and use REMOTE_PORT
instead.
* Cast REMOTE_PORT to int, otherwise the comparison with 1024 is always true
and user data are always inaccessible.

0.9.0 (2015-09-08)
------------------

* GET /user_data uses the shell export by default. ?format=json must be
specified to get the old behavior.
* Only expose user data to root users by limiting access if local port is below
1024.

0.8.1 (2015-09-04)
------------------

* Return HTTP/404 instead of HTTP/500 in GET /user_data/<key> when <key>
doesn't exist.

0.8.0 (2015-09-03)
------------------

* Expose server location in /conf.

0.7.1 (2015-09-03)
------------------

* Force Content-Type to be text/plain to update user data.

0.7.0 (2015-08-31)
------------------

* Update package dependency from ocs-sdk to scaleway-sdk.
* Require ocs.api >=0.38 for unittests since it dropped usage of CustomLog*.
* Expose user data.

0.6.3 (2015-07-15)
------------------

* Fix new release of tox is filtering env variables.

0.6.2 (2015-03-16)
------------------

* Remove direct deps to ``sqlalchemy``.

0.6.1 (2014-11-17)
------------------

* Use patch instead of put on servers in state view.
* Render old format if the image is old. refs: CP-380.
* Add a hostname property in server fields. Refs: CP-356.
* Expose TIMEZONE. Refs: AM-2.

0.6.0 (2014-10-22)
------------------

* Raise dependency on lib-ocs for fixes in shell export.
* Fix name and fluent tag to match convention of other APIs.
* Add PasteDeploy entry-point, refs: SCW-9.
* Switch to split lib-ocs dependencies.

0.5.0 (2014-07-11)
------------------

* Add state view to be able to directly update server state detail from
metadata API. CP-223.

0.4.2 (2014-06-12)
------------------

* Bugfixes.
* Move reusable code to lib-ocs.

0.4.1 (2014-05-16)
------------------

* Fix call super before every action to have the logger properly configured.
* Fix UnicodeEncodeError with shell export.
* Update unittests to work with latest api-compute.

0.4.0 (2014-02-07)
------------------

* api-metadata is a client of api-compute and api-account.
* Improve sh export.
* Remove unused export formats.

0.3.2 (2014-02-03)
------------------

* Cosmetic fixes.

0.3.1 (2013-11-27)
------------------

* Use appropriate dependency from ocs for unittests.

0.3.0 (2013-11-12)
------------------

* Drop all configuration management. It was unused or useless and has been
replaced by command line option parsing.
* Updated documentation.
* Enhanced testsuite and coverage.
* Use object_store factories to simplify unittests.
* Rewrite using view model from ocs.api.

0.2.0 (2013-09-26)
------------------

* Fix long_description.
* Switch to new style models.
* Added metadata tree export.

0.1.0 (2013-09-20)
------------------

* Initial release.

Project details


Release history Release notifications

This version

1.2.7

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for api-metadata, version 1.2.7
Filename, size File type Python version Upload date Hashes
Filename, size api_metadata-1.2.7-py2.7.egg (52.6 kB) File type Egg Python version 2.7 Upload date Hashes View hashes
Filename, size api_metadata-1.2.7-py2-none-any.whl (24.0 kB) File type Wheel Python version 2.7 Upload date Hashes View hashes
Filename, size api-metadata-1.2.7.tar.gz (21.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page