Commit Graph

181 Commits

Author SHA1 Message Date
Digimer
d3b2f2fd35 * Started Storage->scan_directory() that searches a directory (optionally recursively), recording details about files it finds, including mimetypes./
* Added perl-File-MimeInfo to anvil-core (and built a pile of dependencies for the repos).

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-02-12 04:12:45 -05:00
Digimer
dd2b9ec026 * Refined upload.pl a lot, moving it into Anvil::Tools. It also now handles file name collisions and reports basic info about the uploaded file.
* Updated Get->uuid to take the new 'short' parameter that, when passed, asks for just the first 8 bytes of the UUID string.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-02-11 03:36:41 -05:00
Digimer
b5378252fd * Create the shell for the new anvil-manage-files tool.
Signed-off-by: Digimer <digimer@alteeve.ca>
2019-02-08 15:21:24 -05:00
Digimer
0979402ecf * Improved handling of failed connection attempts to remote machines in Remote->call();
* Started work of "Files" (replacement for the media library), including database tables, planned sync flow and web UI.
* Added a check for the /mnt/shared directories and create them as needed in the periodic anvil-daemon checks.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-02-07 03:26:12 -05:00
Digimer
d240f3ae2e * Created files and prep-host icons.
* Renamed a couple Striker-only tools to use the 'striker' prefix instead of 'anvil'.
* Updated the core_tables list.
* Renamed 'sys::log::main' to 'sys::log::file'.
* Fixed some "Back" and "Refresh" links.
* Started planning out the file sync system.
* Started work on the Anvil! setup / host prep system.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-02-06 02:36:19 -05:00
Digimer
3c980a5c6d * Created Job->running() to return '1' when one or more jobs are in progress on the host.
* Started work on a "Jobs" button on the Striker UI to be able to see the progress of jobs that are running in the background.
* Updated the Help icon and added the jobs (tasks) icons.
* Made logging around dhcpd more verbose to help figure out why it's auto-running after initial configuration.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-01-31 23:26:55 -05:00
Digimer
989236c18d * More work done getting PXE working with RHEL8.
Signed-off-by: Digimer <digimer@alteeve.ca>
2019-01-30 01:31:06 -05:00
Digimer
3e2a1faf06 * Updated System->get_os_type() to add comments for RHEL8 and remove Fedora support.
* Updated the pxe.txt template to use RHEL8 and remove Fedora support.
* Updated striker-manage-install-target to support RHEL8 and remove Fedora support.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-01-25 15:04:57 -05:00
Digimer
06228918d6 * Finished fixing anvil-manage-firewall so that it works with RHEL8.
Signed-off-by: Digimer <digimer@alteeve.ca>
2019-01-24 01:41:40 -05:00
Digimer
b7b4e79e95 * Updated System->check_firewall to use firewall-cmd and the contents of iptables-save is not available/reliable under RHEL8.
* Disabled deletion of unneeded zones.
* Updated the default BCN/SN IPs generated in striker to follow the new schema.

Firewall work continues.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-01-23 19:54:01 -05:00
Digimer
2c23c6beba * Improved infinite loop handling in Log->entry, but broke the Striker UI in the process. To be fixed next...
* Added a 'test' parameter to Log->entry, Storage->make_directory and Words->key to help debug in places that Log->x may not be usable.
* Converted many $anvil->Log->x calls to print if $test to help prevent recursive loops, but not all fixed yet.
* Added the new 'host_keys' database table to the schema for a possible new feature of removing passwords in favour if machines adding peers' public keys to their authorized_hosts file.
* Cleaned up the opening calls to $anvil->Tools->new() in most tools.
* Cleaned up some variables in tools/anvil-update-states after reading their values from files (clean trailing newlines).

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-01-18 03:19:36 -05:00
Digimer
d2c812ee03 This commit starts the move to RHEL8 from Fedora 28.
* The 'notes' file has a lot of RHEL8 migration notes added, including RPM build orders.
* The anvil.spec file has switched the source from 'master.tar.gz' to 'anvil-3.0b.tar.gz' and moved the source to our webserver. Updated the dependencies as well.
* Updated anvil.sql to add the 'anvils' table and fixed some SQL schema problems.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-01-17 16:02:57 -05:00
Digimer
02c4fe1fa1 * Updated all perl module modes to remove the executable bit.
* Updated anvil.sql to add the new tables needed for alert mail delivery.
* Update anvil.sql and Database->initialize to now default the user to 'admin' and swap that out if needed, instead of using the #!variable!user!#' replacement variable.
* Started updating anvil.spec for EL8.
* Added support for 'striker::repo::extra-packages' which users can use to add additional packages to the Striker repositories.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-01-05 18:57:44 -07:00
Digimer
53295a0d7f * Updated the variables used for logging and log handles to be more inline with other variable names.
* Renamed Alert->register_alert() to ->register() and updated it to take 'clear_alert' and used it and the alert level to set the title automatically if not set by the user.
* Updated Log->_adjust_log_level() to record when the user set the log level at the command line so that invoked child processes get called with the same log level switch.
* Got the framework for actually calling scan agents in scancore in place. Untested so far.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-12-29 01:23:58 -07:00
Digimer
8fad67fc5a * Updated Words->read to default to 'path::words::words.xml' when the 'file' parameter is not passed. Also updated it to check to see if the words file was read before and, if so, clear the data from the previous read before re-reading it.
* Updated anvil-daemon to re-read the main words file on each loop.
* Updated scancore to read and purge each scan agent's words file between invocations.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-12-28 19:06:26 -04:00
Digimer
946fce018a * Renamed the 'ScanCore' executable to just 'scancore', moved it into the standard 'tools' directory and changed the agents directory to '/usr/sbin/scancore-agents'.
* Got scancore scanning the agents directory, and properly holding on startup until at least one database is available (instead of exiting), and holding on startup until the local system is configured.
* Created the skeleton of the first scan agent; scan-network.
* Fixed a bug in Storage->check_md5sums() where dynamically loaded modules, loaded after the initial md5sum calcs, would cause the calling daemon to exit (possibly on every invocation).
* Created the scancore.README that will eventually be the main scan agent guide / API document.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-12-28 18:17:59 -04:00
Digimer
f5ae90c941 * Started work on M3 ScanCore!
* Started expanding Alert->register_alert() to actually implement it.
* Improved handling errors in Words->key().
* Started work on Striker's "Anvil!" menu section. Also cleaned up the power handling.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-12-18 15:20:49 -08:00
Digimer
2fa4048780 * Updated anvil.conf to default-enable various defaults. Also dropped the archive thresholds.
* Fixed a bug in the PXE default config path to install.img.
* Added tftp to the BCN firewall template.
* Fixed a bug in anvil-daemon / striker-manage-install-target where config files weren't being updated regularly (only when repo updates happened).
* Removed an RPM from striker-manage-install-target that is no longer available on F28.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-12-12 00:10:14 -05:00
Digimer
459fcfbcb3 * Fixed an XML parse error (-- in comments) and pre-set the last_update to 0 to avoid warnings when running anvil-update-system without a job-uuid.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-12-11 13:13:35 -05:00
Digimer
5f77ff5885 * Finished (for now) anvil-manage-firewall. It's been added to anvil-daemon as well.
* Updated Log->entry() to accept 'print => [0|1]' to send a log message to STDOUT (minus prefix) to avoid tools that were repeatedly calling print and Log->entry back to back.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-12-11 02:27:55 -05:00
Digimer
0ca80d0599 * Started work on System->check_firewall() that will collect existing firewall information.
* Updated System->get_ips() to read and parse the interface config file and ignore 'lo'.
* Started working on striker-manage-install-target again.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-12-08 15:37:25 -05:00
Digimer
b5dc83d39c * Renamed anvil-configure-striker -> striker-configure-host and anvil-manage-install-target -> striker-manage-install-target as they're both Striker-specific.
* Fixed a bug in Words->parse_banged_string where some variable strings were not being cleared, causing infinite loops.
* Added job progress reporting in striker-manage-install-target, and made it only refresh the RPM repo when '--refresh' is specified (with --force now forcing the issue). This was done to allow adding it into anvil-daemon in such a way that it would only update the RPM repo once a day.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-12-06 04:14:58 -05:00
Digimer
4b66379aaa * Added enabling/disabling 'Install Target' feature to Striker's WebUI.
* Fixed a bug in Get->anvil_version where the version of local systems and remote systems differed in closing new lines.
* Fixed a bug in Database->insert_or_update_variables() where the 'debug' parameter wasn't working.
* Renamed System->determine_host_type -> System->get_host_type.
* Fixed a bug in System->get_uptime where there was a newline after the uptime integer.
* Updated anvil-daemon to track and record the state of the Install Target feature on Striker dashboards.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-12-04 04:16:38 -05:00
Digimer
67e8f26bdb * Fixed a bug where anvil-manage-install-target was always refreshing the local RPM repository instead on doing so only once per day.
* Finished getting proper storage management and software RAID support added to plan_partition.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-11-29 19:55:23 -05:00
Digimer
9cf70f847c * Lots of work done to add software RAID support to kickstart. Still in progress, however.
* Work on anvil-manage-install-target to enable/disable dhcpd. Also to only refresh the RPM repo periodically. Fixed a bug where it always reported that the kickstart files were not updated, even when they were.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-11-29 04:11:47 -05:00
Digimer
8468215831 * Added logic to tools/anvil-manage-install-target to only update the local RPM repo on a periodic basis.
* Updated tools/anvil-configure-striker to be consistent about naming firewall zones using upper-case.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-11-13 02:47:43 -05:00
Digimer
7f5ac528ab * Got tools/anvil-manage-install-target to now properly build the install repo source! Installing guests is now working, at a base level. Still need to add Anvil! specific stuff, and firewall support. Also decided to emulate the upstream 'Packages' directory structure and moved all packages in to subdirectories based on the first letter of the package.
* Bumped the default PXE menu timeout to 10 minutes.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-11-05 03:33:43 -05:00
Digimer
ea65fa08aa * Added generation of kickstart files from a single template and made them more configurable by the user via anvil.conf.
* Made the PXE spash image come from the active skin.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-11-03 02:55:35 -04:00
Digimer
b815af03df * Created a new RPM (different repo; anvil-striker-extra) for files needed for the Install Target feature but not available in (or reasonably extracted from) RPMs.
* More work on anvil-manage-install-target

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-11-02 02:06:04 -04:00
Digimer
45f290d5e7 * Updated all System->*_daemon methods to not append '.service' to the daemon parameter. Also make all daemon names variables stored in 'sys::daemon::<foo>' and updated existing calls to these methods to use those variables.
* Got anvil-manage-install-target finished creating config files and enabling daemons needed for PXE. Still untested in function though.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-11-01 03:16:07 -04:00
Digimer
6f5541b6fd * Created Get->network() that returns the base network address for a given IP/subnet.
* Fixed a bug in Storage->read_file() where the last newline wasn't always being faithfully recorded.
* Created System->restart_daemon (as opposed to ->reload_daemon).
* Got creating/updating dhcpd.conf / dhcpd working in tools/anvil-manage-install-target.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-10-31 01:42:24 -04:00
Digimer
380b11ce55 * Created Storage->update_file() that will update a file _if_ the contents have changed, locally or remotely and log the diff of the changes that triggered the update.
* Got tools/anvil-manage-install-target to generate and record the PXE BIOS 'default' file from template.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-10-29 19:50:43 -04:00
Digimer
9fe774071e * Started work on making text config files based on templates, started with the tftp 'default' file.
* Got a bit further with tools/anvil-manage-install-target.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-10-26 01:35:54 -04:00
Digimer
317bc730ec * Fixed a bad variable name.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-10-24 23:42:14 -04:00
Digimer
706052105e * Changed Storage->read_file() to default 'force_read' to '1', causing it to always read from disk and ignore cache unless set to '0'.
* After much time wasted chasing a dnf bug (https://bugzilla.redhat.com/show_bug.cgi?id=1641947), tools/anvil-manage-install-target now populates the <DOCROOT>/<os_type>/<os_arch>/os/Packages/ directory with needed RPMs.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-10-24 02:21:41 -04:00
Digimer
3045deb09d * Created tools/anvil-manage-install-target to setup a Striker machine as an install target. Still early in development.
* Created System->get_os_type() to get a short form of the host system OS and version.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-10-23 12:55:19 -04:00
Digimer
07c3b405ad * Starting work on adding "Install Target" function (will likely rename this, but basic same function as IT in m2).
* Added 'sys::database::failed_connection_log_level' to allow silencing of log messages when a Striker peer database is not available.
* Started updating the .spec for the new release to add supported packages needed for PXE/dhcp/tftpboot.
* Added to repo tftpboot files as pulling them out of the packages and moving them into the right place relative to the modest size of adding them directly to our source wasn't justified.
* Created the still very very early 'tools/anvil-manage-firewall' tool.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-10-10 19:43:23 -04:00
Digimer
6f0bc0d86f * Fixed a major bug where anvil-daemon would reset the job_progress to 0 when clearing the 'reboot_needed' flag, causing anvil-daemon to pick the job up and again reboot, repeatedly.
* Updated Jobs->update_progress to take 'picked_up_by' as an optional parameter, defaulting to '$$' (the caller's PID).
* Created System->get_uptime() to return the current uptime in seconds.
* Added a delay to anvil-manage-power to not proceed with a reboot if the uptime is less than 600 seconds. This way, if any future bug causes an infinite reboot, there will be more time to determine what's wrong and debug the system between reboots.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-10-06 03:16:08 -04:00
Digimer
46916b658b * Fixed the spec now that anvil.sql is in the right place and quieted anvil-daemon system check logging.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-10-04 21:38:04 -04:00
Digimer
510321d634 * It looks like adding and removing Striker peers (and all the sync'ing stuff behind it) is finally sorted out. Obviously, time will tell for sure, but currently things look good.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-10-04 20:54:00 -04:00
Digimer
43035ba038 * Fixed a subtle an annoying autovivication bug in Database->write().
* Cleaned up some logging.
* Made the "Reload" buttons work more sensibly and cleaned up some webui display stuff.
* Got deleting peers mostly working (well, it works, but then it goes into a loop thinking it needs to resync the now-gone database until the daemon restarts).
* Fixed a race condition bug where if a job exited between the time that anvil-daemon got a list of PIDs and when it checked to see if that specific pid was alive, a job that actually completed could be restarted.
* Added a loop check to anvil-manage-striker-peers where it would hold until a database connection to the newly added peer was available, preventing a condition where re-adding a peer (and so the host_uuid is in hosts) cause the job belonging to the peer to be recorded locally and then never synced to the peer.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-10-04 03:37:43 -04:00
Digimer
e79e7fd4f4 * Added 'check_if_configured' to Database->connect(), disabled off, that triggers the check to see if the system is configured or not. Updated anvil-daemon to invoke this at the same time that the md5sums are calculated to see if a reload is needed. This reduces the background system load a fair bit.
* Got more work done on deleting peers from Striker (technically done, but untested so far).

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-10-02 03:31:42 -04:00
Digimer
facefeaccc * Fixed a bug in anvil-daemon where completed jobs could be immediately cleared, causing them to re-run (repeatedly).
* Added 'sys::log_date' which controls if the date and time is pre-pended to log entries.
* Created Get->host_name() which takes a host UUID and returns the 'host_name' from the 'hosts' table, if found.
* Cleaned up some HTML templates and logging.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-09-28 01:50:38 -04:00
Digimer
e15fd19ee4 * Fixed a bug in anvil-daemon where a stray 'die' from earlier work was left in.
* Fixed a bug where a double-equal in anvil-configure-striker was causing it not to compile and run.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-09-27 01:54:30 -04:00
Digimer
d3d28d8ec5 * Updated striker's first config page to pre-fill with values (Org name, prefix, sequence and domain name) if they can be devined from the existing system config.
* Updated System->hostname() to return the "pretty" host name as well as the traditional host name.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-09-26 18:55:52 -04:00
Digimer
42c4cd01f9 * Made logging a bit more verbose for job processing in anvil-daemon.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-09-26 00:23:07 -04:00
Digimer
9bd5dd9a18 Revert to bfc2204.
This reverts commit bfc2204352.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-09-25 02:05:07 -04:00
Digimer
a8369170b4 This is the start of a major change!
The resync of the databases was originally designed (on m2) with the expextation that any given column would have only one change per 'modified_date' time. That was never a great approach, but it worked in m2 and just bit me on m3. With job processing, for an example, the job_progress will change repeatedly in one pass, all with the same 'modified_date'. So only one record per run would resync. To fix this, the plan is to drop 'history_id' (and the procedure/trigger in pgsql to copy INSERT and UPDATEs to the history schema). The new plan is to use 'change_uuid' with a per-transaction UUID created in Database so that the per-DB 'history_id' is replaced with a per-update/insert UUID in 'change_uuid'. This will become the unique record used to sync databases, instead or 'modified_date'. To keep things consistent, 'modified_date' was renamed to 'change_date' to match 'change_uuid'. This work is very much "in progress" and not finished.

This commit also changes Get->uuid to use UUID::Tiny to create v4 UUIDs instead of making making a system call to 'uuidgen'. This sped up UUID generation by almost 100x.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-09-23 16:16:08 -04:00
Digimer
bfc2204352 * Added a row-count check when deciding if a DB resync is needed.
* Updated the Database module to not sort or reorder the 'core_tables' array, and reordered them in the hash they're declared in.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-09-22 00:54:37 -04:00
Digimer
e67828b6c6 * Deleted stray exit used in debugging anvil-daemon.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-09-21 13:51:34 -04:00