43 Commits

Author SHA1 Message Date
Auke Kok 3784aea67a meta-data: process public_keys
This adds support for parsing openstack meta-data.json files in
config-2 filesystems and extracting and installing any SSH pubkeys
into the default user account.

In order to properly parse a config-2 json blob outside of the normal
openstack early initialization, we need to fill the parser table
properly and clean it up.

This exposes some flaws in other parts of this code that appear that
this wasn't entirely fully tested. I have not yet confirmed that
in a config-2 scenario everything actually automatically works yet,
this remains to be done.
2017-06-30 12:31:56 -07:00
Ikey Doherty 2c7ba9a934 Replace all instances of clr-cloud-init with micro-config-drive
The project has been renamed from clr-cloud-init to clearly communicate the
scope and target of the project. This change simply ensures all the source
files are now consistent in their agreement of the project name.

The (C) usage was also swapped for ©, simply because it is the proper symbol
and looks better.

Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2016-07-27 14:43:52 -07:00
Auke Kok f9f2dd5b9f Remove CURL support entirely. (#20)
With this change, only config-drive is effectively supported.
2016-06-09 11:33:23 -07:00
Julio Montes 73d1aeb4ea add outdir parameter to curl_fetch_file
files downloaded by curl can be saved in
a safe directory
2016-04-21 14:27:22 -05:00
Julio Montes 5dddbbdc44 Use clr-cloud-init's datadir instead of /tmp to process data 2016-04-21 13:50:45 -05:00
Julio Montes 5218ce78cf use GHashTable to get and run metadata handlers 2016-04-19 12:05:20 -05:00
Julio Montes 3d5ac4b6b7 fix copy user data file 2016-04-15 16:49:03 -05:00
Julio Montes e3a5bf3eab Process openstack user data once per boot 2016-04-15 16:10:20 -05:00
Julio Montes f278175f6d Process openstack metadata once per boot 2016-04-15 15:53:08 -05:00
Julio Montes 55db5e865f fix userdata file not found 2016-04-15 10:30:19 -05:00
Julio Montes fa3099504f fix g_strlcpy assertion when userdata is not found 2016-04-15 10:26:40 -05:00
Julio Montes 381709279a style fix
replace '\0' by 0
2016-04-14 15:17:12 -05:00
Julio Montes 48e1ada26c replace get_boot_info by is_first_boot
is_first_boot uses kernel boot id to identify
the first boot

modify save_instance_id in order to work together with is_first_boot
2016-04-13 15:56:52 -05:00
Julio Montes 1c97e18f07 Split cloud-init service
cloud-init-pre-network:
runs before network service.
this service gets metadata from local datasources
in order to configure network stuff before network service
and configures the instance on its first booot

cloud-init:
runs after network service and will get userdata/metadata
from datasources(local/network). This service fixes disk
and filesystem

add first-boot-setup and no-network options
update documentation
2016-04-13 15:53:25 -05:00
Julio Montes 16c3d6070f fix to save instance id when metadata service is used in openstack datasource
add some logs
2016-02-11 15:08:18 -06:00
Julio Montes 248f8013d5 openstack datasource sets hostname only at first boot 2016-02-04 14:28:43 -06:00
Julio Montes 204c8e6f87 openstack datasource uses async_task functions 2016-02-04 11:31:11 -06:00
Julio Montes a7408871bc re-implement datasource handlers
we can not use systemd to detect first boot because
users can create snapshots of running vm's and boot
these snapshots, therefore metadata must be used to
identify vm's first boot not systemd :(

remove -b, --first-boot option because now clr-clodu-init
is able to identify vm's first boot using instance id

implement uuid metadata handler
2016-01-28 11:20:07 -06:00
Julio Montes 12124ebce1 openstack datasource uses new mount and umount functions 2016-01-22 14:56:56 -06:00
Julio Montes 6831102038 simplify function to free gnode data 2016-01-21 11:31:56 -06:00
Julio Montes 565d7a83d3 rename ambiguous function
openstack_process_metadata -> openstack_process_metadata_file
2016-01-20 14:49:04 -06:00
Julio Montes 8031cb536d implement openstack files metadata handler 2016-01-15 14:32:51 -06:00
Julio Montes 6d32759602 fix openstack_process_config_drive function
user can choose what data process in config drive
using --metadata and/or --user-data options
2016-01-15 11:28:36 -06:00
Julio Montes 823d20be0d simplify openstack_process_config_drive function 2016-01-15 11:17:15 -06:00
Julio Montes d37fc30057 simplify openstack_use_metadata_service function 2016-01-15 10:15:10 -06:00
Julio Montes 6da1266de9 fix indent style 2016-01-14 16:50:06 -06:00
Julio Montes 3be58dcd04 add command line option to process openstack config drive
add --openstack-config-drive option to process metadata and
userdata using as datasource an openstack config drive
(iso9660 or vfat filesystem)

add type_by_device function to get the disk type
2016-01-14 15:01:26 -06:00
Julio Montes 6550a22c7e modify ambiguous logs 2016-01-08 19:57:13 -06:00
Julio Montes 3d9cc12726 use threads to run openstack metadata handlers
improve openstack datasource logs
2015-12-22 12:58:24 -06:00
Julio Montes 1c65ac2509 improve copy file algorithm
fix memory leaks
2015-12-21 11:12:17 -06:00
Julio Montes 78c920d68b fix run userdata on config drive 2015-12-18 13:22:38 -06:00
Julio Montes 5ee5a5311a fix problem running shell scripts 2015-12-15 15:22:27 -06:00
Julio Montes b8055a4530 add support for config drive 2015-12-14 16:04:22 -06:00
Julio Montes 43c5734e3f fix performance issue 2015-12-10 16:24:55 -06:00
Julio Montes 4661ac8cc9 Ensure we use the explicit path to binaries 2015-12-08 11:28:55 -06:00
Julio Montes 40203e6bee add openstack-user-data and openstack-metadata options
update man pages
2015-12-07 16:03:07 -06:00
Julio Montes 19734ef259 improve write_* functions
write_sudo_string is renamed to write_sudo_directives
write_ssh_key is renamed to write_ssh_keys

now these functions use buffers to improve
access to disk (open/write/close functions)
2015-11-30 16:29:32 -06:00
Ikey Doherty 24b84ba453 Make write_ssh_key bool for clarity, ensure return value
In future we should convert openstack_metadata_keys to a boolean function,
and make sure it breaks iteration of the GNode when hitting a failure,
similar to other areas within clr-cloud-init

Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-11-25 16:29:59 +00:00
Ikey Doherty d60802812b Strengthen flags to fix unused variables and unsigned vs signed comparison
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-11-25 16:27:18 +00:00
Julio Montes e304dde92d write 'hostname' to /etc/hostname file
fix format help menu
2015-11-09 13:12:46 -06:00
Julio Montes 959cc765a0 add function to parse openstack metadata
fix memory leaks

Signed-off-by: Julio Montes <julio.montes@intel.com>
2015-11-09 11:58:00 -06:00
Julio Montes 8382f8d76e openstack datasource uses write_ssh_key to write SSH keys
fix list of FIXES

Signed-off-by: Julio Montes <julio.montes@intel.com>
2015-11-06 08:09:18 -06:00
Auke Kok c7d1d9dda7 Initial commit 2015-11-05 18:38:10 +00:00