Commit Graph

458 Commits

Author SHA1 Message Date
Digimer
e35800c413 * Fixed up (though more testing/work needed) to ocf:alteeve:server to get it working with DRBD resources referenced using '/dev/drbd/by-res/...'.
* Added the anvil.conf option 'sys::privacy::strong' that controls if the Anvil! ever "calls home". Initially, this controls DRBD's usage flag.
* Updated DRBD->get_devices() to track resources by their 'by-res' names as well and by the normal '/dev/drbdX' devices.
* To mitigate https://bugzilla.redhat.com/show_bug.cgi?id=1868467, updated Get->bridges() to parse the normal (non-JSON) data if we get invalid JSON output.
* Updated anvil-join-anvil to not disable, and in fact enable, libvirtd on boot. With DRBD 9, the original fear of a user accidentally booting a VM that's running on the peer no longer is an issue. By enabling it and leaving it on, Striker dashboard users won't lose their virtual machine manager link unless the node powers off. Also enabled actually updating the job progress, completing this tool!

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-08-13 00:12:20 -04:00
Digimer
39b4a912af * Remember in the last commit how I said that DRBD->update_global_common() was done? Well that was cute, 'cause it was quite broken. Now it's working.
Signed-off-by: Digimer <digimer@alteeve.ca>
2020-08-10 15:42:05 -04:00
Digimer
d647014ad1 * Created (finished but not yet tested) DRBD->update_global_common() to update DRBD's global_common.conf file.
* Cleaned up a lot of log levels.

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-08-07 23:12:11 -04:00
Digimer
ef208fd3fb * Finished the logic for adding stonith devices and levels to pacemaker! More testing is needed though, bugs expected, but it adds them.
Signed-off-by: Digimer <digimer@alteeve.ca>
2020-08-06 17:45:43 -04:00
Digimer
c27cc7507f * Renamed striker-parse-fence-agents to anvil-parse-fence-agents and changed anvil-daemon to run it on all machines.
* Cleaned up a lot of logging.
* Updated Cluster->parse_cib() to track if a stonith device has 'delay' set.
* Got a lot more work done on anvil-join-anvil's stonith processing, but it still isn't complete. Updated it to change shell user passwords as well.

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-08-06 01:20:53 -04:00
Digimer
d2d5d7b460 * Fixed a bug in Striker->load_manifest() where fences were parsed twice, the second time missing a hash reference.
* Updated striker to now only offer gateway for IFN networks. EL8 seems to ignore 'GATEWAY="x"' in interface configs which caused anvil-join-anvil to always think an interface needs to be updated. Updated as well to remove DNS entries set in interfaces that are not the default gateway.
* Fixed a bug where DNS entries were being missed, causing entries to be repeatedly added to the interface that was the gateway interface.
* In anvil-update-states, added Get->switches() so that verbosity switches are used.

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-07-28 00:59:02 -04:00
Digimer
1bf71f8428 * Updated Database->get_hosts() to run host_ipmi the Log->is_secure if the string contains 'passw'.
* Fixed Database->get_ip_addresses() to clear stale IP addresses.
* Finished (for now, more testing needed) System->configure_ipmi! Also created System->test_ipmi() that handles trying lanplus and various password lengths, updating hosts -> host_ipmi on successful check.

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-07-24 16:22:27 -04:00
Digimer
ef70f90ba4 * Updated Log->entry() to set the log file handle to UTF-8 when opened.
* Got more work done to System->configure_ipmi() to warm reset HP IPMI BMCs. It also now finds the IPMI user have started the password management.
* Created Words->shorten_string() that shortens a string to a number of bytes (as opposed to shortening to a character length).

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-07-22 22:32:33 -04:00
Digimer
dcfdf1127c * Got more work done on System->configure_ipmi(). It should now configure the IP address, subnet mask and default gateway using information from the manifest and anvil-join-anvil data.
Signed-off-by: Digimer <digimer@alteeve.ca>
2020-07-22 03:00:44 -04:00
Digimer
1fa63d2ea3 * Added 'anvil_uuid' as a set parameter in Database->get_hosts().
* Added calling 'debug => $debug' in System->X methods.
* Got more work done on System->configure_ipmi(). It should now determine if a BMC exists and pull the OEM and network details automatically.
* Updated anvil-configure-host to log more data in an attempt to find a reproducer for an odd bug where (apparently) a host was picking up the wrong job data meant for another host.

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-07-21 02:00:56 -04:00
Digimer
99afd2e936 * Fixed a bug in Database->manage_anvil_conf() where initializing a host set the DB information with the wrong DB port and password.
* Fixed a bug in Get->host_type() the type wasn't being set for nodes and dr hosts.
* Fixed a bug in Validate->host_name() where the wrong method was being called.

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-07-17 22:49:25 -04:00
Digimer
01974d7efe * Finished (though testing is needed) the updated ocf:alteeve:server resource agent. It now handles starting and stopping libvirtd and drbd daemons on-demand.
Signed-off-by: Digimer <digimer@alteeve.ca>
2020-07-16 00:33:00 -04:00
Digimer
dcd1fd1492 * Created Cluster->check_node_status() that checks the status of a node (in pacemaker).
* Created Cluster->get_peers() that figures out who the peer node (and DR host, if applicable) are.
* Updated Cluster->parse_cib() to dig out more information.
* Created Cluster->start_cluster() to start pacemaker (via pcsd) locally or on all (both) nodes.
* Started working on ocf:alteeve:server to start/stop the libvirtd/drbd daemons as needed, instead of having pacemaker do it.
* Got more work done on anvil-join-anvil. Node 2 now waits for the cluster to start, and node 1 will do setup as needed, then wait for the cluster to start as well.

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-07-15 18:40:37 -04:00
Digimer
62d0a2aa39 * Created Cluster->parse_cib() that parses pacemaker's CIB (cluster information base) XML. This also switches to the XML::LibXML, starting the replacement of XML::Simple. It's far from finished, but parses out basic node data and fence data.
Signed-off-by: Digimer <digimer@alteeve.ca>
2020-07-11 23:26:19 -04:00
Digimer
597d9413a5 * Created the skeleton Cluster.pm.
* Got anvil-join-anvil to the point where is initializes and starts the cluster.
* Deleted the old ssh key handling logic in anvil-daemon.

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-07-10 00:49:30 -04:00
Digimer
16157f7697 * Finished System->update_hosts().
Signed-off-by: Digimer <digimer@alteeve.ca>
2020-07-07 16:37:27 -04:00
Digimer
de43ea3ac1 * Renamed all Validate->is_X to Validate->X. Also created Validate->ipv6() to validate IPv6 addresses using Data::Validate::IP (and added it as a requirement to the .spec base RPM).
* Added the fix from the last commit for System->call to handle returned data without an ending newline to Remote->call.
* Got more work done on System->update_hosts(). It's able to add new hosts, but misses the short and FQDN host names. Need to fix that and the verify existing / manual entries aren't molested.

Signed-off-by: digimer <digimer@pulsar.alteeve.com>
2020-07-07 01:18:38 -04:00
Digimer
76b6550ac6 * Created Database->get_ip_addresses() that pulls the IPs out and stores them in a hash that allows for easy referencing to associated interfaces and networks.
* Created Get->trusted_hosts() that finds the dashboards the host uses and, if the host is in an Anvil!, the peers in the same anvil.
* Created (but not finished yet) System->update_hosts() that will add and edit entries for all IPs to trusted hosts.
* Fixed a logging bug in Striker->load_manifest().
* Fixed a bug in System->call where, the the output from the shell call didn't end in a new-line, it would not parse the return code and lease the return code string appended to the shell output.
* Fixed a big in System->change_shell_user_password() where a new-line (\n) meant for the shell call wasn't escaped properly. There was also a duplicate 'return_code' variable preventing the actual return code from being read.
* Got more work done on anvil-join-anvil to update the hacluster password (when needed).

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-07-03 18:11:56 -04:00
Digimer
aa2fdfb609 * Fixed a bug in Database->get_anvils() that was clearing the manifests hash.
* got anvil-join-anvil working up to the start of configuring pacemaker.

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-07-03 00:49:08 -04:00
Digimer
453f5c6223 * Fixed a bug where $anvil->nice_exit() was being passed 'exit' instead of 'exit_code' as a parameter.
* Update striker manifest run to add an entry into the 'anvils' table, and pass the anvil_uuid to the jobs rather than the various host_uuid's.
* Fixed a bug in the 'anvils' SQL procedure that copied data into the history schema (a few columns were missing).
* Updated anvil-configure-host to reboot when finished to be certain network changes have taken effect. Also updated the handling of virsh bridges to delete the autostart symlinks if libvirtd daemon isn't running.
* Added some logic to anvil-daemon to call 'anvil-update-states' with the -v{1,3} flag depending on the active debug level.

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-06-24 00:39:56 -04:00
Digimer
bd9e74a7b1 * Added missing packages to the RPM spec and the RPMs to provide on Striker.
Signed-off-by: Digimer <digimer@alteeve.ca>
2020-06-18 18:46:04 -04:00
Digimer
b076463b5f * Fixed a bug in multiple System daemon control methods where the return_code wasn't being returned properly.
Signed-off-by: Digimer <digimer@alteeve.ca>
2020-06-18 15:17:34 -04:00
Digimer
9ab03e1f17 * Added a check to verify that connections to multiple databases are not, in fact, going to the same host.
* Added a global switch --resync-db which takes a UUID and forces that DB to be marked as needing a resync.

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-06-17 20:11:20 -04:00
Digimer
7d907c15ff * Created the new tools/striker-purge-host tool which purges all data about a host from the database.
* Updated Database->get_hosts() to store 'host_key' and 'host_uuid' data.
* Created Database->get_ssh_keys().
* Fixed a couple bugs where Get->host_type() now returns 'striker' but tests checked for 'dashboard'.

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-06-16 17:04:27 -04:00
Digimer
726a4374d1 * Renamed the database table 'host_keys' to 'ssh_keys' to better represent what it stores.
* Updated 'variables' -> 'variable_source_uuid' to type 'uuid' and removed the 'not null' constraint.
* Updated Database->insert_or_update_variables() to check/update 'variables_source_table' and 'variables_source_uuid'.
* Created the 'trusts' database table which will, when done, tell anvil-daemon which users@machines to trust (setup passwordkess SSH).
* Created (but not finished) System->manage_authorized_keys() and moved the logic over to it from anvil-daemon.
* Changed the host types "dashboard" to "striker".
* Moved the following methods from 'System' to 'Get';
** System->get_host_type to Get->host_type
** System->get_bridges to Get->bridges
** System->get_free_memory to Get->free_memory
** System->get_os_type to Get->os_type
** System->get_uptime to Get->uptime
* Updated striker to include the host_uuid for the 'node1', 'node2' and (if chosen) 'dr1' when running a job manifest.

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-06-10 18:26:50 -04:00
Digimer
530fb31478 * Updated Jobs->get_job_details() to use --job-uuid switch or, failing that, look for an incomplete on this host with the same command as the calling program.
* Got anvil-join-anvil to the point that it reworks the network configs, updates MTUs and configured NTP.

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-06-03 21:52:13 -04:00
Digimer
613a7f0c58 * Created the new anvil-join-anvil tool that will run on nodes and the DR host to pick up the job to join an Anvil! system.
* Finished the saving of a "run manifest" job menu. Included filtering out potential machines already in other Anvil! systems from the select box and updating the password fields to not trigger a browser to save/auto-complete the field.
* Fixed a bug in Database->get_hosts() caused by the attempt to immediately return with a 0 if it had been called before. Now a check is made in ->insert_or_update_manifests() where the recursive loop was possible.
* Updated the RPM spec to v.33 after releasing .32 after the last commit. Also added the core requirement for perl-Data-Validate-Domain.

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-05-27 22:39:00 -04:00
Digimer
22e7e8b03e * Finished the "run manifest" form / page. Actually saving / pushing the job to nodes is not yet done though.
Signed-off-by: Digimer <digimer@alteeve.ca>
2020-05-26 21:37:02 -04:00
Digimer
e99bfac9be * Created Database->get_anvils() and ->insert_or_update_anvils().
* Updated the anvils database table to have columns for traching which hosts are used as node 1, node 2 and the DR host.
* Updated Database->get_hosts() to check which, if any, Anvil! a given hosts is attached to.

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-05-25 00:02:52 -04:00
Digimer
c5c75f1ddf * Created Database->get_manifests() that loads manifests into a hash but UUID and name.
* Got deleting of manifests done.
* Fixed a couple bugs from the _network to _ip variable rename.
* Fixed a bug where fence variables with double-quotes in them weren't being handled properly.

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-05-23 23:54:36 -04:00
Digimer
f0f949bcf0 * Created Striker->load_manifest() to load (and parse) install manifests.
Signed-off-by: Digimer <digimer@alteeve.ca>
2020-05-17 15:23:12 -04:00
Digimer
099bc1401a * Finished the menus to save a new Install Manifest and got the create page showing the existing manifests.
* Updated Database->insert_or_update_manifests() so that not passing in 'manifest_last_ran' is OK.

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-05-14 17:52:14 -04:00
Digimer
23c17dbb98 * Renamed Network->match_gateway() to ->is_ip_in_network(), and changed the parameters 'gateway -> ip' and 'ip_address -> network'. This is to clarify it's use as a general purpose "does this IP fall in the given network range?".
* Created the shell of Striker->generate_manifest() that will pull out CGI data to generate the install manifest itself and save/update it.
* Got step 3 menu finished along with the corresponding sanity checks.

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-05-12 18:50:11 -04:00
Digimer
e54aaad807 * Added MTU, NTP and DNS fields to install manifest step 2.
* Got the first BCN part of step 3 working.

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-05-07 11:17:56 -04:00
Digimer
7edfd0cb2d * Added gateway support to install manigest creation step 2.
* Finished sanity checking install manifest step2.

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-05-05 23:11:47 -04:00
Digimer
5835e49ef4 * Got the install manifest form step 1 sanity checks done. Got the form for step 2 done.
* Updated Template->select_form() to add the 'style' paramter (for CSS style options), and added the ability to set the 'options' to the special value 'subnet' that builds an options box showing usable CIDR subnets.

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-05-04 22:56:23 -04:00
Digimer
1351889b4d * Continued work on creating Install Manifests. Got the frame of step 1 done.
Signed-off-by: Digimer <digimer@alteeve.ca>
2020-05-03 23:01:44 -04:00
Digimer
e66bc32693 * Added the ability to store, edit and delete UPSes
** Created Database->get_upses() and ->insert_or_update_upses().
** Created Striker->get_ups_data(). This parses the special 'ups_XXXX' strings.
* Updated Validate->is_domain() and added ->is_host_name() to use the Data::Validate::Domain module (which is now required in the core RPM).
* Started work on manifest handling.
* Sorted the language keys alphabetically.

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-05-02 23:05:58 -04:00
Digimer
1edf723ea5 * Finished adding support for deleting fence agents.
* Added the 'include_deleted' parameter to Database->get_fences().

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-03-30 23:14:10 -04:00
Digimer
f49f3cd890 * Created Database->get_fences() to load existing fence devices into memory.
* Removed fences -> fence_type from the database schema, wasn't needed.
* Updated Striker->get_fence_data() to store data in the 'fence_data' parent hash so to not conflict with 'fences' used in Database->get_fences().
* Got the saving and loading of fence devices working.

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-03-19 01:33:07 -04:00
Digimer
1f17c9dcfe * Fixed a bug with the 'Back' button when going back from the fence configuration confirmation screen.
Signed-off-by: Digimer <digimer@alteeve.ca>
2020-03-12 02:11:01 -04:00
Digimer
f71c16484a * Got the fence config confirmation screen working.
Signed-off-by: Digimer <digimer@alteeve.ca>
2020-03-12 00:25:17 -04:00
Madison Kelly
3838babf57 * OK, this time CentOS is actually supported. For reals.
** Needed to add a couple more packages to CentOS's package list.
** Changed the PXE kickstart template to create a dedicated '/boot' partition (raw partition or on RAID 1). This seems to be required now on 8.1.
** Added PXE's UEFI support to the template system (untested, but it's at least generated now).
* Filtered out 'debug' and 'verbose' options when configuring fence devices.
* Added an internet test to tools/striker-manage-install-target and skipped attempting to download packages when there's no internet. Also made loading the host OS info into a small function.
* Started creating the man pages.

Signed-off-by: Madison Kelly <mkelly@alteeve.ca>
2020-02-03 02:10:00 -05:00
Madison Kelly
27f921289f * Fixed PXE templates managing install targets to work with CentOS.
Signed-off-by: Madison Kelly <digimer@neutron.digimer.ca>
2020-02-02 17:39:56 -05:00
Madison Kelly
83d6cff4af * Fixed a bug with striker's initial configuration where 'update_value_only' was being set for the initial store of the config variables.
* Added fonts to Striker's RPM list and to the anvil-striker RPM dependency list so that the terminal is actually useful.

Signed-off-by: Madison Kelly <digimer@neutron.digimer.ca>
2020-01-23 21:45:27 -05:00
Digimer
00b9bce669 * Cleaned up a couple things in the fence config menu.
Signed-off-by: Digimer <digimer@alteeve.ca>
2020-01-22 23:25:10 -05:00
Digimer
b8c0577b54 * Fixed several issues with the fence configuration menu in striker.
* Added filters Striker->get_fence_data() for parameters. Manually change 'action' entries from 'string' to 'select' and use the data in the 'actions' element to populate it, with actions that don't make sense filtered out.

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-01-22 15:21:35 -05:00
Digimer
818ef23634 * Moved the fences_unified_metadata file from /tmp, which apache can not read, to /var/www/html/.
* Fixed a bug (well, made a work-around for an issue without a known reproducer) where, on some occassion, a record will end up in the public table without being copied into the history schema. When this happens, the next resync would crash out because the resynd reads in the history table only. Now, when about to INSERT a record into the public schema during a resync, an explicit check is made to see if the record alread
y exists. If it does, the INSERT is instead redirected to the history schema.
* Cleaned up the fence agent metadata when displaying to a user, converting the shell codes to underline a string with square brackets instead. We also now replace newlines with <br /> tags. Lastly, to help fence_azure_arm's metadata description to display cleanly, a check is made to format the table correctly.
* Began work on the Striker menu for handling fence device management

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-01-20 23:41:01 -05:00
Digimer
f636e399d7 * Created tools/striker-parse-fence-agents which finds all the available fence agents on a system and gathers their metadata into a common XML file.
* Created Striker->get_fence_data() that reads/parses the unified fence metadata file created by tools/striker-parse-fence-agents.
* Created the new 'fences' database table and Database->insert_or_update_fences() to handle it.
* Added hosts -> host_ipmi that will, later, store information on how to access the host's IPMI interface, when available.
* Sketched out how the new Install Manifests are going to work.

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-01-15 17:04:18 -05:00
Digimer
b82051cb37 * Finished the new Databse->insert_or_update_manifests() method and started the manifest page in Striker.
Signed-off-by: Digimer <digimer@alteeve.ca>
2020-01-11 00:02:08 -05:00
Digimer
7df405afcb * Created the manifest database table and Database->insert_or_update_manifests().
Signed-off-by: Digimer <digimer@alteeve.ca>
2020-01-10 15:57:11 -05:00
Digimer
76e9352717 * Added a flag that tells anvil-daemon when a node is having it's network mapped. When this happens, open ssh connections are closed each loop and only tasks related to mapping the network run. This improves responsiveness in Striker when reporting which network links have come up or gone down.
* Fixed a bug in Database->insert_or_update_variables() where, if 'update_value_only' was set but not variable_uuid was passed or could be found, an (incomplete) INSERT would be attempted.
* Added support for generating module metadata when setting up local repos on Striker.

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-01-09 01:52:04 -05:00
Digimer
4cf9d6215c * Removed the table host_mail_servers.
* Added a check in striker-manage-install-target to watch for and remove bad RPMs.

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-01-06 19:47:37 -05:00
Digimer
e764eccf6e * Started work on Email->check_alert_recipients().
* Created Database->get_recipients() (from what used to be get_alert_recipients), as well as ->get_mail_servers() and ->insert_or_update_notifications().
* Renamed 'recipients -> notification_anvil_uuid' to 'notification_host_uuid'.
* Started work on scancore -> check_email.

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-01-05 15:07:35 -07:00
Digimer
754435685e * Fixed a couple bugs when handling alert recipients.
* Fixed a bug where deleting records from numerous tables didn't use the active time stamp.

Signed-off-by: Digimer <digimer@alteeve.ca>
2020-01-01 00:53:29 -07:00
Digimer
9e16cdf504 * Created Validate->is_email() to validate email addresses, using Mail::RFC822::Address.
* Finished (but not yet tested) the menu to manage alert recipients.
* Created Words->language_list() that creates a hash reference of available languages.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-12-31 23:43:52 -07:00
Digimer
eb0481bcb0 * Created Database->insert_or_update_recipients() (and did general cleanup of the database module).
* Started work on Striker's notification recipient management page. Cleaned up the variable names in the mail_server management function.
* Added recipients -> recipient_units column to the sql schema.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-12-28 11:20:09 -07:00
Digimer
98211e1228 * Finished the mail server configuration menu. Mail servers can be added, edited, and deleted now.
Signed-off-by: Digimer <digimer@alteeve.ca>
2019-12-27 23:12:13 -05:00
Digimer
d4a5882bb4 * Created Validate->is_port() to validate TCP/UDP ports
* Got Striker to the point where it can save mail servers (not load existing or delete yet, though).
* Added a check to striker-parse-oui so that it only runs once per day.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-12-26 21:06:31 -05:00
Digimer
c48e9a174c * Created Tools->_domain_name() to return the host's domain name portion of their full host name.
* Created Database->insert_or_update_mail_servers() to insert/update entries in the 'mail_servers' table.
* Got more work done on the email server menu. It now shows the entered values, but not yet save the data.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-12-26 00:17:17 -05:00
Digimer
a3105c08a7 * Started work on the mail server form.
Signed-off-by: Digimer <digimer@alteeve.ca>
2019-12-24 23:13:23 -05:00
Digimer
c3869a2ff6 * Started adding in front-end support for managing email servers and alert recipients. Added the new 'Email' module to (later) habdle all email-related tasks.
* Fixed a bug in Accounts->read_cookies where, when a user's hash had expired, the logged error message didn't show the user's name.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-12-23 00:54:09 -05:00
Digimer
2f81275551 * Updated the kickstart template/script to now add the local striker to the installed system's dnf repo list.
* Fixed a bug in the tftp templates where the os_type was statically set to 'rhel8'.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-12-20 00:54:07 -05:00
Digimer
974d3c3411 * Fixed the order or table creations in anvil.sql (as well as fixed a missing comma)
* Fixed / added 'delete' parameters for Database->insert_or_update_bridges(), ->insert_or_update_bonds(), ->insert_or_update_ip_addresses() and ->insert_or_update_network_interfaces().

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-12-17 23:36:26 -05:00
Digimer
a16e86dc7c * Finished tools/anvil-configure-host! More notably, it can now update the network without a reboot, and it cleanly handles losing and reconnecting to dashboards.
* Added 'no_ping' to Database->connect() to disable pinging before connection, regardless of the anvil.conf setting.
* Created Network->read_nmcli() that reads, parses and stores the verbose output from 'nmcli'.

I can not properly explain in this commit message how much getting network manager working tripped me up. omg the complexity of what used to be such a simple process...

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-12-13 22:20:18 -05:00
Digimer
9bcad1c4bf * Did more work on adapting tools/anvil-configure-host to work on nodes and DR hosts.
* Fixed a bug in Job->get_job_details() when no job_uuid was passed.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-12-11 00:38:48 -05:00
Digimer
b97f15b25e * Finished the sanity checks and user confirmation table when preparing to configure the network on a node or dr host.
Signed-off-by: Digimer <digimer@alteeve.ca>
2019-12-10 02:38:55 -05:00
Digimer
6d81e03fb2 * Created Network->match_gateway() to check if a gateway applies to a given network.
* Got more work done on confirming the user's request to setup the network of a node or DR host.
* Reworked network select boxes to sort by the network name instead of the MAC address.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-12-08 00:19:13 -05:00
Digimer
86af67ecda * Created a cachine mechanism for anvil-update-states so that it can record network interface link state changes when it loses contact with all databases, as can happen when cycling NICs to map a newly build DR host or node.
* Updated Database->insert_or_update_network_interfaces() to take the new 'link_only' and 'timestamp' parameters to support flushing out the cache file above.
* Updated anvil-daemon to run anvil-update-states when the database connection is lost. Also moved the 'handle_periodic_tasks()' function call to be conditional on there being a database connection.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-12-05 01:59:41 -05:00
Digimer
530d379f59 * Started work on caching network state change in tools/anvil-update-states.
* Fixed a bug where ip_addresses could break resync when 2+ machines had the same IP (ie: 192.168.122.1).
* Updated logging of DB transactions to show the DB host's IP instead of the UUID.
* Updated Get->date_and_time to take a 'use_utc' parameter to return the time using GMT time instead of the host's TZ.
* Updated anvil-daemon to periodically call tools/anvil-update-states. Also upadted anvil-daemon to delay daily jobs by 2 hours except for the dashboard with the highest sorted UUID to minimize dual runs of tasks that only need to run once per day per cluster.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-12-04 00:02:19 -05:00
Digimer
e8d15112da * Fixed a bug in anvil.js where the state of a link always said 'up', even when it was down.
* Fixed a couple logging bugs in System->call().
* Fixed a bug in anvil-daemon where it was trying to setup setuid-C wrappers on non-dashboards.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-12-03 01:23:31 -05:00
Digimer
0dfd2ddbf0 * Renamed 'ip' to 'ip_address' in Striker->parse_all_status_json() and related functions.
* Got the menu for mapping a host's network displaying (much work still to be done).
* Updated the anvil.js funtion to run dependent on the page being shown. For the main menu, the json is now properly reread and display updated as json content changes.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-11-29 23:37:11 -05:00
Digimer
0b2439edc3 * Finished the jquery/css stuff for showing the list of hosts that can have their network configured.
* Fixed unclear error logging in Network->find_matches().
* Updated System->generate_state_json() Striker->parse_all_status_json() to determine if another machine can be reached from the local dashboard. If it can be reached, the first matching interface and IP are recorded.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-11-27 23:26:21 -05:00
Digimer
c608ebb232 * Added bonds -> bond_bridge_uuid to track which bridge, if any, that a bond is connected to. Updated Network->load_interfces() to record this.
* Added missing foreign key references to the SQL schema.
* Added support to tools/anvil-update-states to connect bonds to bridges, as appropriate.
* Finished the logic in test.pl to pull the network data (with connections between bridges, bonds and interfaces) needed for the WebUI.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-11-26 00:15:37 -05:00
Digimer
54de5466cf * Renamed bond_active_slave to bond_active_interface.
Signed-off-by: Digimer <digimer@alteeve.ca>
2019-11-21 10:55:21 -05:00
Digimer
12b0cc28f0 * Renamed 'primary_slave' to 'primary_interface' for the bond table.
* Got more work done on parsing the all_status.json (and fixing related bugs).

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-11-20 01:45:16 -05:00
Digimer
d5672e77eb * Standardized 'subnet_mask' over 'subnet' naming throughout.
* Created (and haven't finished yet) Striker->parse_all_status_json().

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-11-19 02:13:19 -05:00
Digimer
b2ff4c4c53 * Created Network->get_company_from_mac() that converts a MAC address to the company name that owns it.
* Added recording the last-change order for network interfaces in System->generate_state_json() so that the most recently unplugged and plugged back in interfaces can be tracked.
* Worked out a faster way to ping scan subnets with nmap in striker-scan-network. Dropped average scan time from 35 minutes to 4~5 minutes for a /16 subnet.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-11-15 18:29:07 -05:00
Digimer
387c03aa7d * Added more text for the pending JSON state file generation.
Signed-off-by: Digimer <digimer@alteeve.ca>
2019-11-13 21:29:51 -05:00
Digimer
7cf1db3b37 * Added strings for making size suffixes translatable and updated Convert->bytes_to_human_readable to use them.
* Fixed a bug in tools/anvil-update-states where the MAC of an interface that is the backup in an active-backup bond would be the MAC of the active member instead of its real MAC.
* Fixed a bug in Convert->add_commas() where a passed in value of '0' returned an empty string.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-11-12 16:27:01 -05:00
Digimer
b9e8d2a971 * Added suffixes for data sizes.
Signed-off-by: Digimer <digimer@alteeve.ca>
2019-11-11 18:18:29 -05:00
Digimer
ea27f88bcc * Removed the 'bridge_interfaces' table and related database methods. This was found to be duplicate, given that 'network_interfaces' has references to parent bonds and bridges.
* Renamed 'bridges' -> 'bridge_mac' to 'bridge_mac_address' to be consstent with other MAC address column names.
* Finished Network->load_interfces().
* Updated anvil-update-states to check for interfaces under bridges that are missing their 'network_interface_bridge_uuid' reference UUID.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-11-07 23:40:02 -05:00
Digimer
628f7faa45 * Updated the RPM spec file to generate '/etc/anvil/type.X' files to directly indicate the machine type. Updated System->get_host_type() to check for these files directly, falling back to parsing the host name if they don't exist.
* Created Database->get_hosts_info() (though it's not at all finished) that will write out a unified JSON file contain all data known about all hosts/Anvil! systems. This will be later used to create the WebUI parts.
* Also created, but also not finished, Network->load_interfces() that will work sort of like ->load_ups, but include all interfaces regardless of if they have an IP or not.
* Fixed a bug where the new bridge_interface_note parameter didn't exist in the Database->insert_or_update_bridge_interfaces() method.
* Updated anvil-update-states() to only write out the JSON/XML files if it's running on a dashboard. For nodes and DR hosts, it just needs to update the database.
* Created a new hook in anvil-daemon that will call tasks on a machine that is configured.
* As per RHEL 8.1 release notes, changed the package 'dnf-utils' to 'yum-utils' in the packages to load for install target repos.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-11-06 11:26:21 -05:00
Digimer
077977ad9c * Fixed tools/anvil-update-states so that it properly removed ip_addresses no longer assigned to a host. Also merged 'network::interfaces::by_name::${interface}' with 'network::local::interface::${interface}' for storing discovered interfaces.'
* Added 'ip_address_note' to the 'ip_addresses' table as there was no column convenient for flagging as DELETEd.
* Added 'uuid' to Database->insert_or_update_file_locations() and ->insert_or_update_files(), and actually used it in all ->inser_or_update_X() methods.
* Added 'delete' as a parameter to Database->insert_or_update_ip_addresses() to allow simple deletion of a referenced IP address.
* Addressed a few 'undefined variable' errors.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-11-02 00:02:36 -04:00
Digimer
197f5ed90e * Finished the automatic archving of the database! New in M3; Archving happens on dashboards only, and whichever database triggers an archive will archive all data in any connected databases. This is a departure from where each host archived it's own data, but will avoid putting a disk or CPU load on server hosts.
Signed-off-by: Digimer <digimer@alteeve.ca>
2019-10-28 02:27:26 -04:00
Digimer
650dc6eb80 * Finished Storage->compress(). Also added some missing 'port' parameters (reads and passes) in a few different Storage methods.
Signed-off-by: Digimer <digimer@alteeve.ca>
2019-10-27 17:19:03 -04:00
Digimer
b29bfd4c59 * Added some logging to the archive method.
Signed-off-by: Digimer <digimer@alteeve.ca>
2019-10-26 20:07:03 -04:00
Digimer
b436500a54 * Started working on getting database archiving working. It's close to done, but needs testing/debugging and other finery.
* Created Database->get_host_from_uuid() that takes a host UUID and returns the host's name.
* Reworked Network->find_matches() to return both the match's IP and subnet.
* Finished getting tools/striker-initialize-host to add all known peers to the target, using IPs on the target's available subnet.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-10-26 01:53:52 -04:00
Digimer
934c9b1286 * Updated logging to now log anything with 'priority' set to a new 'anvil.alert.log' file (while still also logging as normal to anvil.log). This should make it easier to watch for alert messages.
Signed-off-by: Digimer <digimer@alteeve.ca>
2019-10-22 21:17:30 -04:00
Digimer
af6e2c076d * Fixed a tricky deep recursion bug in Network->is_local when the passed in host was an empty string. Also created a cache system where a host name that has been checked before is immediately returned, without needing to run through the logic in 'is_local', which gets called quite frequently.
* Updated the loop detection logic in Log->entry where processing large strings was triggering it when it shouldn't.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-10-20 22:55:49 -04:00
Digimer
a7f93c59ea * Reworked striker-parse-oui and striker-scan-network to always lower-case the MAC address.
* Updated striker-scan-network to only run once per day unless --force or a given --network is used. This avoids repeated scans when the anvil-daemon restarts frequently for whatever reason.
* Fixed (for real this time) Convert->time's handling of the 'long' parameter.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-10-18 11:40:38 -04:00
Digimer
4d0a02ce74 * Fixed a bug in Database->get_local_uuid() where ->is_local() was being called incorrectly.
* Added job parsing to tools/striker-parse-oui and tools/striker-scan-network, and enabled them in anvil-daemon.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-10-17 13:08:11 -04:00
Digimer
1d13e669a7 * Created the new tools/striker-scan-network tool that ping scans a network range and records the discovered hosts in the new 'mac_to_ip' table. Also created Database->insert_or_update_mac_to_ip() to handle the new table.
Signed-off-by: Digimer <digimer@alteeve.ca>
2019-10-16 23:23:02 -04:00
Digimer
7e960f1632 * Created the 'oui' database table that stores the parsed OUI data, as processed by the new 'tools/striker-parse-oui' tool. Also created Database->insert_or_update_oui() to handle inserts and updates.
* Fixed a bug in Convert->time() where the suffix was long when it should have been short, and vice-versa.
* Updated Network->download() to check if the target file exists and, if so, to abort unless 'overwrite' is given or the existing file is 0-bytes long. Also updated it to not exit on immediate error after the wget call and instead check to see if a zero-byte file exists and remove it, if so.
* Created Validate->is_hex() to check hexadecimal strings.
* Updated Words->clean_spaces() to remove MS-DOS-style ^M cr/lf characters.
* Updated anvil-daemon to have a section for periodic tasks that run daily, and added striker-parse-oui as well as moved striker-manage-install-target refresh to that check. Also made those tools run on dashboards only.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-10-16 01:57:59 -04:00
Digimer
7cdd2f60e9 * Created Network->download() to handle downloading a file on the local system. Created ->bridge_info() to parse 'bridge' output. Created ->load_ips() to load IP address information from the database (as opposed to ->get_ips() which queries a system).
* Created Database->insert_or_update_bridge_interfaces() to handle updating the new bridge_interfaces database table that records which network interfaces are connected to which bridges.
* Added 'bridge_mac' and 'bridge_mtu' to the 'bridges' table.
* Started Server->map_network which will, eventually, try to map MAC addresses to IPs and record server -> vnetX -> bridge data. Made getting a server status target-dependent.
* Worked on anvil-update-states to parse and record bridge data.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-10-12 00:32:32 -04:00
Digimer
183d2d9cce * Updated Storage->backup to append a short UUID to the timestamp to prevent issues if the same file is backed up twice in the same clock second. Also fixed a bug with remote_user parameter not having a default.
* Finished the detection of and handling of initialization of a host when the host has no Internet access.
* Disabled (for now) anvil-daemon's check_ssh_keys function.
* Fixed a couple small bugs elsewhere.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-10-04 22:36:39 -04:00
Digimer
65a27ba2f8 * Created Network->check_internet() that, well, checks to see if a machine has access to the Internet or not.
* Moved System->is_local to Network->is_local, and System->ping to Network->ping.
* Added a check to tools/striker-get-peer-data that will report if the target has Internet access or not.
* Cleaned up the form that prompts the user to enter their Red Hat credentials.
* Updated tools/anvil-manage-keys (and related code) to no longer distinguish by user. If a target is flagged as changed, it is removed from the root and all user's known_hosts files.
* Updated Storage->write_file() and ->update_file() to accept the 'backup' parameter to control if an file that exists is backed up before being updated/replaced.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-10-04 00:40:30 -04:00
Digimer
3a86bed694 * Fixed tools/striker-initialize-host so that it set the hostname on the target, not locally.
* Updated System->host_name to work locally and on remote targets.
* Renamed all 'hostname' instances to 'host_name' to standardize on a spelling throughout the program.
* Removed use of and dependency on 'hostname'.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-10-02 15:39:21 -04:00
Digimer
b57546e663 * Fixed a bug in Database->manage_anvil_conf() where the wrong password and port was being set.
* Fixed a bug in Get->host_uuid() where the call to get the host UUID from dmidecode was broken.
* Updated striker -> Initialize host to allow the user to set the host name of a node or host being initialized, allowing it to be registered with Red Hat under the proper name and make it easier to track which machine is which during initial Anvil! build.
* Fixed a few minor bugs with variable insertions into translated strings.
* Updated striker-initialize-host to use a progressive progress value rather than statically assigned steps.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-10-02 02:04:22 -04:00
Digimer
3e01537209 * Updated how bad keys are removed. No longer are speciifc lines removed by number, but now all entries for the given target in the known_hosts file is removed.
* Updated the pxe.txt file to now write a caller for anvil-update-issue in /etc/NetworkManager/dispatcher.d/ifup-local to have the /etc/issue file is updated as soon as the network is brought up, before the GDM login prompt is shown.
* Fixed a couple bugs in tools/anvil-manage-keys, including to ensure that the permissions are retained when a file is updated.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-09-27 23:21:24 -04:00
Digimer
6bca354d87 * More progress on managing/removing back keys. Updated it to have jobs list one or more state_uuid(s) to be removed, instead of bulk-removing all found back keys. Created the web interface to let the user select the keys to be deleted. Works partially now, but bugs need to be removed.
Signed-off-by: Digimer <digimer@alteeve.ca>
2019-09-27 01:31:29 -04:00
Digimer
566ec896ca * Created tools/anvil-manage-keys to handle user requests to remove bad keys from known_hosts files for target machines that have been rebuilt or replaced.
* Added a check to Remote->call() where, when a connect attempt fails because of a changed/bad key, it is reported as such to the user/logs and an entry is recorded in the state file.
* Started adding a Striker menu function showing users a list of bad keys in known_hosts files and the ability to remove old keys.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-09-26 01:06:16 -04:00
Digimer
37f36fe99c * Updated kickstart to write the basic tools/anvil-update-issue to a freshly installed machine and run it from cron.
* Updated Remote->call() to detect when a connection fails because the target's known_hosts entry has changed. Still need to add the function to report this to the user.
* Fixed a bug where new-lines in Words->parse_banged_string() where a double-banged word string's variable value would cause an infinite loop.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-09-24 23:35:31 -04:00
Digimer
2ca19699b8 * Added abunch of required packages to tools/striker-manage-install-target to support installing offline nodes, DR hosts and Striker dashboards.
Signed-off-by: Digimer <digimer@alteeve.ca>
2019-09-24 11:39:09 -04:00
Digimer
b9a0cc4d56 * Finished the initial tools/striker-initialize-host!
* Created Tools->refresh to reload anvil.conf in one call.
* Created Anvil::Tools::Network to hold network-related tasks.
** Created Network->is_remote() that tests to see if a string (containing a target) refers to the remote machine (versus a local machine). Updated all previous checks to use this new method.
** Moved Get->network_details() and Get->network() to the new Network module. Renamed Get->network() to Network->get_network().
** Made Network->get_ips() work locally and remotely.
** Created Network->find_matches() that compares two scanned machines IPs (via two previous calls to Network->get_ips())
* Created Database->manage_anvil_conf() that will add, update or remove a given database connection in a local or remote anvil.conf file.
* Fixed bugs in Storage->backup() where the bash calls were quite broken. I'm not sure how it ever worked before... x_x
* Updated anvil-daemon to not initialize a database unless it's running on dashboard. Also added a check at the startup of anvil-daemon where it will go into a loop waiting for a database to become available, re-reading anvil.conf each loop.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-09-22 23:36:59 -04:00
Digimer
a54e0d4e22 * Made a fair bit more progress on tools/striker-manage-install-target. It now registers a system with Red Hat and attaches appropriate subscriptions, updates the OS and (tries) to install anvil-{node,dr}.
* Fixed a bug in Remote->call where a shell call that ended in a newline would work, but throw an error and not get the return code.
* Created Database->get_job_details() which takes a job_uuid and returns the job details, if found.
* Fixed a bug in Jobs->update_progress() where 'clear' wasn't removing the old job_progress data.
* Added the parameters 'no_files' to skip stat'ing/recording non-directories, and 'search_for' which will set the parent directory in 'scan::searched' and stop scanning if found. This allows this method to act as a directory tree scanner and as a search engine.
* Created Striker->get_local_repo() that builds a repo file body suitable for adding to peers, nodes and DR hosts.
* Fixed bugs in the Striker WebUI related to initializing a target node / DR host.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-09-18 18:48:09 -04:00
Digimer
badaa39b7a * Got the node/dr host initialization form to the point where it can test access and decide if it should show the Red Hat account form. Decided that for M3, node/dr host setup will now be a four-stage process; initial install (over PXE), initialization (install the proper anvil-{node,dr} RPM and connect to the database), setup/map the network, and then add to an Anvil! pair.
* Updated striker to no longer try to SSH to a remote machine. To enable this, we'd have to give apache a shell and an SSH key, which is dumb and dangerous when considered.
* Created tools/striker-get-peer-data which is meant to be invoked as the 'admin' user (via a setuid c-wrapper). It collects basic data about a target machine and reports what it finds on STDOUT. It gets the password for the target via the database.
* Updated anvil-daemon to check/create/update setuid c-wrapper(s), which for now is limited to call_striker-initialize-host.
* Created Anvil/Tools/Striker.pm to store Striker web-specific methods, including get_peer_data() which calls tools/striker-initialize-host via the setuid admin call_striker-initialize-host c-wrapper.
* In order to allow striker via apache to read a peer's anvil.version, which it can no longer do over SSH, any connection to a peer where the anvil.version is read is cached as /etc/anvil/anvil.<peer>.version. When Get->anvil_version is called as 'apache', this file is read instead.
* Updated Database->resync_databases() and ->_find_behind_databases() to ignore the 'states' table.
* Created tools/striker-initialize-host which will be called as a job to initialize a node/dr host.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-09-16 00:17:02 -04:00
Digimer
6f74ca376b * Created anvil-daemon->check_setuid_wrappers() function that will dynamically create setuid c-wrappers on daemon startup, when needed.
* Updated variable names to clarify their purpose in striker.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-09-11 12:58:57 -04:00
Digimer
99e1e4faf2 * Figured out how to collect a peer's data. Passwords are passed via the 'state' table. Created a setuid c-wrapper as well.
Signed-off-by: Digimer <digimer@alteeve.ca>
2019-09-10 23:11:25 -04:00
Digimer
2906a42d96 * Created tools/striker-get-peer-data that will query a target's host UUID and host name. It's meant to be called by apache, avoiding apache itself needing to call ssh against a target machine.
* Fixed a bug in Storage->read_file() where a remote read, where the remote user wasn't specified, would cause the call to hange.
* Cleaned up striker->add_sync_peer() to use more clear variable names.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-09-09 23:51:30 -04:00
Digimer
b8816382b8 * Created Log->is_secure() to more cleanly handle conditional logging of strings with passwords or passwords directly. Updated log entries that could benefit from this method to use it.
* Cleaned up the striker->add_sync_peer() function to more clearly differentiate the ssh port from the pgsql port.
* Improved the HTML form to not have the browser treat host login fields as credentials to autofill or save.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-09-08 22:54:47 -04:00
Digimer
b51f87bdcc * Figured out a way to prevent browsers (for now, at least) from treating the node/host login form from saving passwords or pre-filling passwords.
* Updated Get->cgi to not include any passwords in the cgi_string that is recorded for refresh.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-09-07 08:15:11 -04:00
Digimer
db1afb766e * Fixed a bug in Words->parse_banged_string() where a variable being inserted that ended in a new-line would break the variable insertion into the string.
* Switched the icons for prep'ing a node or DR host and building an Anvil!.
* Started work on the node/dr host initial setup webUI.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-09-05 21:21:03 -04:00
Digimer
bc341809ca * Finished (for now) ocf:alteeve:server! It can boot, migrate and stop a server cleanly. It still checks to see if DRBD needs to be started and does so when needed, but it won't stop it anymore.
* Fixed a couple typos in tools/anvil-check-memory that prevented it from running.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-09-04 18:58:43 -04:00
Digimer
8a2c86d088 * Renamed striker-configure-host (back) to anvil-configure-host, and started updating it to work on any machine type.
* Created tools/anvil-check-memory to report how much RAM is used by a given program.
* Added documentation for some previously undocumented methods.
* Updated Database->archive_database() to take the 'tables' parameter.
* Updated Storage->scan_directory() to record a directory's mode and type, even when recursive isn't used.
* Finished System->check_memory().
* Updated ocf:alteeve:server to now NOT stop a DRBD resource unless 'stop_drbd_resources'.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-09-03 14:07:39 -04:00
Digimer
ed2e83a1a4 * Fixed a few more bugs in 'ocf:alteeve:anvil', but it's still failing when invoked by pacemaker.
Signed-off-by: Digimer <digimer@alteeve.ca>
2019-08-20 23:46:59 -04:00
Digimer
113a44ecc6 * Got 'migrate_to' working in ocf:alteeve:server. 'migrate_from' still needs work.
* Created DRBD->allow_two_primaries() and ->reload_defaults() that enables (and resets/disables) dual-primary operation (allow-two-primaries=yes), used to enable live migration.
* Created Remote->test_access() that simply verifies that a remote target can be accessed (as a given user).
* Created Server->migrate() that actually migrates a server. It can push already, and pull will be added next.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-08-16 01:41:47 -04:00
Digimer
873ed3e2b0 * Fixed some typo bugs.
* Added stop_drbd_resources() to ocf:alteeve:server.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-08-12 23:15:13 -04:00
Digimer
dff74102db * Create (but not yet tested) Server->shutdown() to, well, shutdown servers.
* Modified Server->boot() to now only work locally. Also updated it to optionally take the XML definition path for the server to boot.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-08-10 01:35:08 -04:00
Digimer
d224be9344 * Created DRBD->manage_resource() that allows for up/down/primary/secondary'ing a resource on a local or remote system.
* Created Server->boot() that starts a server and verifies that it did actually start.
* Got ocf:anvil:server smarter about starting DRBD resources, properly handing resources where auto-promote isn't enabled. The 'start' process is now complete (baring bugs).

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-08-08 22:58:21 -04:00
Digimer
b1ddf945e2 * Got ocf:alteeve:server working again to boot servers. It's now smarter, knowing when the server is running locally already (success), running on the other node (hard error) and running on DR (fatal error).
* Updated DRBD->get_devices() to store data all under 'drbd::config::<host>::x'.
* Created Server->find() that takes a target and collects the servers running on it.
* Updated System->check_storage() to redirect all calls STDERR to /dev/null to supress errors about failing to open /dev/drbdX when LVM's filter isn't setup.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-08-08 01:10:38 -04:00
Digimer
324ef351fe * Updated DRBD->get_devices() to properly identify the peer node, when run on an actual node in the cluster (not DR or Striker).
* Created System->active_lv() that, surprise, activates an inactive logical volume. Also created ->check_storage() that parses out the LVM data.
* Fixed a bug in tools/fence_pacemaker that was preventing it from compiling and running.
* Updated ocf:alteeve:server to validate the target server's storage.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-08-06 23:31:35 -04:00
Digimer
a5761df894 * Got migration (push and pull) working.
Signed-off-by: Digimer <digimer@alteeve.ca>
2019-07-19 01:05:30 -04:00
Digimer
3cf1ad2ff8 * Fairly heavy rework of ocf:alteeve:server to update how it handles storage during server start. It now properly handles the new "one resource, multiple volumes" and "start resource, not daemon" approach.
Signed-off-by: Digimer <digimer@alteeve.ca>
2019-07-18 02:53:05 -04:00
Digimer
7e4a170382 * Fixed a bug where Tools.pm->_anvil_version() and Get->host_uuid() were storing values in the wrong $anvil hash.
* Fixed a bug where Get->host_uuid() wasn't reading from the host.uuid file.
* Updated Remote->call() to record a target's fingerprint when needed.
* The ocf:alteeve:server resource agent now properly stopps a server and the corresponding DRBD resource.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-07-17 02:41:05 -04:00
Digimer
b56fbf923c * Finished the initial convertion of ocf:alteeve:server to use Anvil::Tools.
Signed-off-by: Digimer <digimer@alteeve.ca>
2019-07-16 00:14:13 -04:00
Digimer
c0220c9635 * Continues work on migrating ocf:alteeve:server to use Anvil::Tools.
Signed-off-by: Digimer <digimer@alteeve.ca>
2019-07-14 01:01:50 -04:00
Digimer
9c0f6b8f79 * Added automatic 'echo return_code:$?' to System->call and Remote->call which is parsed out and returned automatically on all calls.
* Started porting ocf:alteeve:server to use the Anvil::Tools module and updating it for RHEL 8.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-07-13 04:16:03 -04:00
Digimer
188ecdbbd7 * Improved handling of missing RPMs when downloading RPMs for tools/striker-manage-install-target's repo.
* Updated package list to fix changed dependencies from RHEL 8 beta to final.
* Changed anvil_daemon to only check DHCP once per minute instead of every loop.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-06-28 00:37:08 -04:00
Digimer
ae095ab85a * Updated the RPM build order and list for RHEL 8 final.
* Replaced 'screen' with 'tmux' in the spec file.
* Fixed a couple typos in the SQL schema that prevented it from loading.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-06-24 17:54:52 -04:00
Digimer
5d91211dff * Continued work on 'anvil-download-file', in-progress adding support for job processing.
* Updated Database->insert_or_update_jobs() to use job_data when looking for a job uuid. Also fixed logging and adapted 'jobs::X' variable feeding to prevent them being undefined. Also made the search find jobs with the program name anywhere in the string, instead of just the start of the strong.
* Started work on Jobs->update_progress() to handle updating downloading file information.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-04-04 12:27:27 -04:00
Digimer
605c3c4ffb * Got anvil-download-file downloading files. Much testing is needed, and it's just the barebones so far.
* Added to Convert->time the 'translate' parameter that controls if the returned string is already translated or not.
* Updated Storage->change_mode and ->change_owner to rename the parameter 'target' to 'path' to help prevent future confusion woth most other instances of the 'target' parameter meaning a target machine.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-03-29 02:51:47 -04:00
Digimer
c41adb17ff * Finished converting Remote->call() to use Net::OpenSSH. Also updated all calls to this method to expect the output as a single (sometimes multi-line) string instead of an array reference. Also updated all calles to expect 'output' first, 'error' second.
* Added a 'timeout' parameter to Remote->call() to limit the time that a command on a remote host can run, with a default of '10' (seconds).

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-03-27 02:16:45 -04:00
Digimer
b1326e1b4e * Created tools/anvil-download-file which will handle downloading, aborting and reporting status of downloads.
* Started working on Convert->time().
* Changed anvil-manage-files skip /mnt/shared/temp when looking for files to add to the database.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-03-15 02:40:44 -04:00
Digimer
beb1197c1b * Finished support for deleting files (locally and globally) using anvil-manage-files.
Signed-off-by: Digimer <digimer@alteeve.ca>
2019-03-14 01:13:49 -04:00
Digimer
dc95b8c4e3 * Got anvil-manage-files able to find and pull down missing files.
* Added 'expect' the anvil-core spec requirements.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-03-12 02:27:31 -04:00
Digimer
e8afd2efe4 * Created anvil-file-details that is (meant to be) called by anvil-file-details on a remote machine.
Signed-off-by: Digimer <digimer@alteeve.ca>
2019-03-08 00:27:30 -05:00
Digimer
040f189ea6 * Finished (barring bugs) the SSH handling in anvil-daemon. Now, keys added to the database (machine and user's) will auto-propegate out to any other machines in the cluster (all machine types).
Signed-off-by: Digimer <digimer@alteeve.ca>
2019-03-05 01:26:21 -05:00
Digimer
ff5ef43940 * Continued work on the ssh configuration system in anvil-daemon.
* Created Database->insert_or_update_host_keys().

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-03-01 01:42:12 -05:00
Digimer
80e7bc5ce0 * Started work on a system to provide inter-machine ssh communication without needing to track or record passwords in the database or config files (outside the database access passwords). Added 'host_key' to the 'hosts' table that stores the host public key. Also now create ssh public/private key pairs for the 'root' and 'admin' users.
* Fixed some bugs in anvil-update-states so that bonds are recorded properly in the database.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-02-27 00:23:03 -05:00
Digimer
47280c8fd9 * Added 'files -> file_directory' to help distinquish cases where two different files of the same name exist in different directories.
Signed-off-by: Digimer <digimer@alteeve.ca>
2019-02-22 02:10:55 -05:00
Digimer
529c12d2e2 * Updated anvil-manage-files to scan all /mnt/shared/* directories to search for new files. Only files in incoming are moved though, as before. Starting work on pulling files now.
* Updated the files table to add the file_mtime. In the future, if two versions of the same file exists on different machines, the one with the more recent mtime will be copied over the others.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-02-21 23:57:26 -05:00
Digimer
d9e9884e53 * Created Storage->move_file().
* Finished getting anvil-manage-files to find and process new files in /mnt/shared/incoming. Created a 'convert_mimetype' function to translate returned mimetype to a file type we care about.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-02-21 01:37:51 -05:00
Digimer
e3d11fd938 * Did some more work on anvil-manage-files.
Signed-off-by: Digimer <digimer@alteeve.ca>
2019-02-15 01:50:38 -05:00
Digimer
0d62a28fda * Created Database->insert_or_update_file_locations().
* Fixed some bugs in Database->insert_or_update_files() and the 'files' table/procedure in the SQL schema.
* Got more work done on anvil-manage-files.
* Created Job->get_job_details().
* Added an executable check for files in Storage->scan_directory().
* Cleaned up some logging and switched to Job->get_job_details() in anvil-update-states and striker-configure-host.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-02-14 04:25:52 -05:00
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
d68b85fe9e * Working on a file upload with progress bar feature. Expect more changes as it is refined.
Signed-off-by: Digimer <digimer@alteeve.ca>
2019-02-08 03:21:51 -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
9fd0aa3e0f * Finished getting the Jobs page working. Needs more testing, but seems to be working fine.
* Created Job->html_list() to return the list of running or recently completed jobs, and used it instead of the code formarly used in 'striker' when Striker was unavailable.

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-02-01 01:39:11 -05:00
Digimer
276364db33 * Fixed a path issue for adding the local repo in the spec file.
* Fixed a typo in the SQL schema.
* Removed pxelinux.0 (moving PXE related stuff to anvil-striker-extra).

Signed-off-by: Digimer <digimer@alteeve.ca>
2019-01-30 15:10:16 -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
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
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
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
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
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
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
90bbcfe9f4 * Updated Database->insert_or_update_jobs() to have 'update_progress_only' conditionally update 'job_status', 'job_picked_up_by', 'job_picked_up_at' and 'job_data'.
* Updated Database methods that can take the caller's file or line to append the local file and line.
* Updated Jobs methods to call Database->insert_or_update_jobs().
* Updated the remaining UPDATEs of 'jobs' table to use 'Database->refresh_timestamp()' for the 'modified_date'.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-09-25 13:50:48 -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
40aac1d5f6 * Finished adding the 'sessions' database table and associated code.
* Added a check to all 'Database->insert_or_update_*' methods to check if the passed-in reference UUID was found and return an empty string if not.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-09-21 13:49:28 -04:00
Digimer
b2367bb90b * Started working on moving user sessions to the new 'sessions' table. This is still a work in progress.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-09-17 15:34:43 -04:00
Digimer
c6e781d80b * Adding database peers (local and bidirectional) now works!
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-09-13 17:08:50 -04:00
Digimer
7bd65f65e5 * Finished the first round of updates to anvil-manage-striker-peers, but the initial resync is failing because of unrelated schema issues.
* Updated Database->insert_or_update_jobs() to also use the job_command when looking for an existing job (when a specific job_uuid was not included).
* Fixed a bug with a missing ? in striker->add_sync_peer function. Also updated it to not try to record the peer's job as it is unlikely the peer will be in hosts. Instead, the job_command to add the peer is appended to the local job't job_data and the updated anvil-manage-striker-peers looks for that at the end of the add and sync, and records the job once the peer's UUID is in 'hosts'.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-09-13 02:22:35 -04:00
Digimer
2a03663ecf * Created System->find_matching_ip() which takes a host and finds which local network (if any) is on the same subnet.
* Continued work on managing Striker peers.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-09-10 19:54:22 -04:00
Digimer
4bf048054b * Udated anvil-daemon to not use Time::HiRes for now, and added a timer so that the md5sum of files used by the daemon are checked only once per minute. This significantly reduced the load caused by the daemon running.
* Bumped the RPM spec file to 15, though haven't actually rolled the new RPM yet. Also added 'htop' as an anvil-core dependencies.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-09-10 02:17:02 -04:00
Digimer
94d8a9c495 * Fixed a bug where finished jobs with a '0' picked-up time would be written to jobs.json.
* Updated anvil-configure-striker to use Job methods and reboot using anvil-manage-power. Also updated it to set/clear maintenance mode and mark a reboot required at the end of it's run just prior to reboot.
* Lots of log cleanup.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-09-07 01:29:43 -04:00
Digimer
00565b123c * Updates Tools->nice_exit to add the caller name to the exit status.
* Created Job->clear() to clear the job_picked_up_by column. Created Job->get_job_uuid() to return the job_uuid of an unfinished job matching a given job_command string (if any found).
* Updated striker->process_power to log the user out after confirming a poweroff or reboot action.
* Added anvil-daemon --startup-only to not enter the main loop and exit.
* Finished getting poweroff and reboot working (though more testing needed).

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-09-06 01:37:08 -04:00
Digimer
b7e4ba9123 * Made the detection of whether a system has been rebooted a lot smarter, thanks to an idea from Lisa Seelye (@thedoh).
* Got the webui portion of requesting a poweroff and reboot done, but still working on finishing anvil-manage-power (work on which lead to the above improvement).

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-09-05 03:39:13 -04:00
Digimer
545f9a9bb5 * Renamed tools/anvil-reboot-needed to tools/anvil-manage-power and started adding support for rebooting and powering off to it.
* Created the Anvil::Tools::Jobs module to handle general job processing task. Moved 'update_progress' from tools/anvil-update-system to it and generalized it.
* Added some missing CDATA wrappers to the words XML file strings with '>' in it.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-09-04 18:57:09 -04:00
Digimer
962ff89fc5 * Fixed a bug in Words->parse_banged_string() where values with commas was breaking the processing of the string of variable/value pairs.
* Added '--refresh-json' to anvil-daemon that auto-selects '--run-once', '--main-loop-only' and '--no-start'.
* Updated anvil-update-system to not go more than a second between updates to the progress (save for when we're holding on data from 'dnf').

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-09-03 02:35:25 -04:00
Digimer
5d9977b924 * Added counters to show the user during anvil-update-system runs.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-09-01 13:08:24 -04:00
Digimer
423fda2ad6 * Fixed a bug in anvil-daemon where rebooting was clearing the reboot-needed flag.
* Finished (for now) adding support for monitoring jobs while a node is in maintenance mode!
* Cleaned up the display of job data and redid how buttons (real and classed links) are displayed to be consistent.
* Fixed a bug in anvil-daemon where a disconnect wasn't being called between loops, causing DB connections to pile up.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-08-31 02:40:49 -04:00
Digimer
93124ea3ae * Added a message to anvil-update-system to report when no updates were needed.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-08-30 03:31:52 -04:00
Digimer
eecef192b3 * The job progress display in Striker while in maintenance mode is coming along and mostly working now.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-08-29 19:52:05 -04:00
Digimer
eaca4c885f * Updated tools/anvil-daemon to use the JSON module to build the JSON strings going into jobs.json, instead of doing it manually.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-08-29 00:33:33 -04:00
Digimer
831ff14d93 * Created Words->parse_banged_string to process strings in the format '<key>[,!!var1!value1!!,!!var2!value2!!,...,!!varN!valueN!!'. Still testing this.
* Made anvil-update-system look for a job_uuid when none is passed.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-08-28 22:42:46 -04:00
Digimer
60584b8cee * Created Database->get_jobs() to be a more general way to retrieve pending and recently finished jobs.
* Started adding the display of running and recently finished jobs to Striker when in maintenance mode. Still lots to do.
* Started working on the logic for what will soon be Words->decypher_string in anvil-daemon to process strings stored as '<key>,!!<name1>!<value1>!!,...,!!<nameN>!<valueN>!!'.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-08-28 01:54:49 -04:00
Digimer
bd862b2e5e * Made more progress on anvil-daemon's invokation of jobs.
* Got anvil-update-system clearing job data when (re)starting

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-08-27 02:51:53 -04:00
Digimer
633da25d07 * Fixed a bug in Database->connect where an empty 'database::<key>' would cause an error. Updated Database->disconnect to delete the 'database' hash key as part of the same fix.
* Renamed 'database::locking' to 'sys::database::locking' to avoid collisions with 'database' keys.
* Fixed a problem with System->call where reidrects were missing the Proc::Simple method name.
* Updated anvil-daemon to check if there is no database connections on start-up, run prep-database if not, and try connecting again. If it still fails, exit. Also updated the main loop to reconnect to the database(s) and skip if non are available. Did more work on the keep_running() function.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-08-24 00:52:56 -04:00
Digimer
c3a26c32f0 * Added a power off button to managing the Striker.
* Added a reboot button to managing the Striker. This button and the text associated with it reflects the need for the reboot.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-08-23 00:52:12 -04:00
Digimer
18455ab5f7 * Created System->reboot_needed() to set/clear/report if a reboot is needed.
* Renamed tools/anvil-clear-reboot to tools/anvil-reboot-needed and changed it to behave like anvil-maintenance-mode.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-08-22 19:50:20 -04:00
Digimer
0191f93bad * Created tools/anvil-maintenance-mode to enable/disable maintenance mode from the command line.
* Fixed a bug in System->maintenance_mode where disabling it wouldn't work.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-08-22 17:57:50 -04:00
Digimer
d147e10552 * Changed the call to reboot after OS update to instead set a reboot required flag.
* Created tools/anvil-clear-reboot to clear the "reboot needed" flag. Also created, but not yet using (and may not use) units/anvil-boot-time.service.
* Started work on having jobs show their data via JSON / jquery.
* Updated anvil-update-system to record messages indicating the progress so far.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-08-22 02:16:56 -04:00
Digimer
51c9d2952d * Fixed a bug with caching database handles in the recent database updates causing Database->write to stop working.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-08-16 19:34:37 -04:00
Digimer
fe33fbb239 * Created System->maintenance_mode to add "maintenance mode" support to Striker.
* Continuing work on adding the system update job support to Striker. Untested/Incomplete.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-08-16 02:38:58 -04:00
Digimer
6aa74d3d96 * Updated Database->_test_access() to use the DBD 'ping' method, and attempt a reconnect of failure.
* Updated Database->connect to take a specific UUID to attempt a connection to.
* Renamed some old 'sys::x' variables related to the database to 'sys::database::x' to conform better to coding standards.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-08-15 16:57:57 -04:00
Digimer
dd88051d9b * Finished the initial version of tools/anvil-update-system.
* Updated the RPM to .13 to disable postun's disabling of postgres, which breaks Anvil! software using the database during RPM updates.
* Fixed a logging bug where the number of DB connections was not inserting the number properly.
* Fixed exits in tools/anvil-prep-database.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-08-14 03:45:36 -04:00
Digimer
a63bfb0799 * Added support to reconfigure a Striker system.
* Started adding support for updating the striker (and later, all) systems. This will be handled by the in-progress tools/anvil-update-system program.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-08-13 18:25:48 -04:00
Digimer
252fbf21ef * Fixed a bug where '$anvil->' wasn't referencing '$anvil->data->' when it should have been.
* Got anvil-manage-striker-peers working properly (so far).
* Updated anvil-prep-database to call anvil-manage-striker-peers, but testing still needed.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-08-13 02:22:46 -04:00
Digimer
1106d36e03 * Fixed bugs in tools/anvil-manage-striker-peers, basic testing done.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-08-11 23:20:03 -04:00
Digimer
89c06b9f24 * Started work on tools/anvil-manage-striker-peers to do the actual work on managing local and peer databases in anvil.conf.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-08-08 15:10:29 -04:00
Digimer
0fa3c42f2f * Fixed a bug where setting the debug level to 3 caused a deep recursion and a system hang.
* Update Anvil::Tools->new() to access the parameters 'log_level', 'log_secure' and 'debug', streamlining the frequent calls to $anvil->Log->level and ->secure in program startup, and allowing the values to take effect during the ->new constructor.
* Passed 'debug' to child method calls in more places (still more to do though).
* Fixed a bug where 'test_table' wasn't set in the right place, causing the database to try to initialize repeatedly.
* Made Database->archive_database only run if called with root access.
* Now the number of database connections are stored in 'sys::db_connections' instead of checking the returned number, and that is cleared on disconnect.
* Started working more on 'anvil-daemon', including adding support for System->call being taking 'background', 'stderr_file' and 'stdout_file' paramters which, when set, used Proc::Simple to background the process.
* Did some more work on database archiving, though still far from done.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-08-01 02:06:16 -04:00
Digimer
a364141d81 * Added a check/cycle to Remote->call that checks to see if the channel was established and loops up to five times, with a second delay in each try. Also disable the Time::HiRes stuff in this method for now.
* Fixed a bug where "form::error_massage" was default to '&nbsp;' which caused simple checks to thing there was an error when all was fine.
* Got the "add new sync peer" form confirmation box displaying and cleaned up the CSS a bit.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-07-30 01:53:36 -04:00
Digimer
839bfc8a2d * Updated Striker to better handle when host.uuid hasn't been generated yet on brand new installs.
* Updated anvil-update-state to add commas to network link speeds.
* Added dmidecode to the spec file

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-07-25 21:02:48 -04:00
Digimer
9ab242a117 * Decided to move development to Fedora 28 to prepare for the leap to RHEL 8. So this commit is the first where the Anvil! Striker can be installed.
* Updated Get->users_home() to default to return the hore directory for the user running the program.
* Updated Remote->call() to start working on handling timeouts.
* Updated Storage->change_owner(), ->make_directory() and ->write_file() to default the the user and group running the program.
* Fixed a bug in home reporting the MAC address of NICs when confirming configuration of Striker. Also changed showing the domain to the hostname.
* Got more work done on sync peers.
* Updated the RPM spec file to install on Fedora 28.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-07-25 02:34:47 -04:00
Digimer
b24b20ec89 * Working on saving the new peer. Made progress on, but not yet finished, sanity checking the new peer form values.
* Cleaned up some docs.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-07-20 03:08:44 -04:00
Digimer
578c23b0a3 * Finished the form for adding peers (but no logic to support it yet, it's just filled and formatted).
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-07-19 16:40:03 -04:00
Digimer
1ac1bc5ffb * Made more progress on the peer database configuration page.
* Added a switch to tools/anvil-configure-striker to prevent reboots.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-07-18 18:32:39 -04:00
Digimer
2c52f649ba * Fixed the path of anvil.sql
* Set Log->entry to chmod the log file to 666 when the file is opened to ensure apache can write to it.
* Fixed a string replacement variable name.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-07-13 03:26:53 -04:00
Digimer
2d88502f6a * Continued work on the sync page.
* Updated rpm spec to bring in gnome when installing anvil-string.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-07-11 02:14:21 -04:00
Digimer
ee649ff2dd * Started work on the Striker sync function. It shows (without formatting yet) the ways the local dashboard can be accessed.
* Added another check and better error handling to Template->get() to print a more useful message if a template is found but fails to parse.
* Moved some strings into the words file.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-07-07 01:31:40 -04:00
Digimer
6e19d45845 * Updated Template->get to print a useful error message of a template is not found in a file.
* Moved templates around different files to clean things up.
* Moved the "back" and "refresh" icons over to the right by the logo, and added a new icon for handling mail, alerts, install targets and manifests.
* Started work on the Striker configuration sub-page.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-07-06 03:07:45 -04:00
Digimer
19672f8b7c * Started work on the Striker menus, adding mechanisms for "back" and "refresh".
* Fixed a bug where the old style '#!replace!...!#' replacement variables were not being escaped when processing variable insertions into strings.
* Made the body variable be stored in 'form::body' instead of passing around the '$body' variable.
* Created a set of new icons.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-07-04 17:57:25 -04:00
Digimer
1079c65687 * Finished working on the log in and log out functions of Striker. Still super basic, but it works!
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-06-27 18:13:16 -04:00
Digimer
3fce021498 * Making good progress on the internal login/account methods. The user can now log in, though the first reload logs them right back out. Lots still broken.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-06-27 01:28:13 -04:00
Digimer
66928edb06 * Added logic to check if Striker is configured and, if so, enter main functions.
* Finished up the configuration logic for Striker.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-06-22 01:43:43 -04:00
Digimer
2febb09d72 * Updated anvil-configure-striker to handle network configurations in non-bonded configurations and to remove virsh bridges.
* Added error messages to Striker configuration forms.
* Fixed a bug in home->get_network_details() function to handle single IPs in network.xml.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-06-20 19:50:56 -04:00
Digimer
39c06f364f * Got tools/anvil-configure-striker updating the system passwords now.
* Updated System->get_ips to only record 'sys::mac::<mac>::iface' for actual interfaces, not bonds.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-06-02 00:22:40 -05:00
Digimer
4e6f492c4f * Updated Log->variables to add dots when printing a variable/value pair per line so that variables line up vertically.
* Renamed tools/anvil-configure-network to tools/anvil-configure-striker given that it will also now update system passwords.
* Started working on tools/anvil-update-states to properly handle a Striker with already-configured networking.
* Cleaned up tools/anvil-change-password.
* Fixed a bug in Storage->update_config to set the ownership of anvil.conf to 'apache:apache' so that the web server can read it.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-05-21 22:02:45 -04:00
Digimer
2163739b93 * Created Storage->update_config that will update a variable in anvil.conf (locally or remotely).
* Finished (for now) tools/anvil-change-password.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-05-21 03:11:47 -04:00
Digimer
59245a4f0b * Created Account->validate_password to test that a user name and password is valid.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-05-18 12:23:55 -04:00
Digimer
d110bff224 * Created Account->encrypt_password() for creating encrypted hashes of passwords. Set the default algorithm to sha256, a ~16 byte random salt and 500,000 re-encryptions (which takes a total of about 0.7 seconds on an Intel i7-6820HQ CPU).
* Added user_algorithm and user_hash_count to the new users database table so that we can remember how a hash was generated, should it be changed down the road.
* Made the salt length configurable by the user (as well as the algorithm and loop count).

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-05-15 17:45:52 -04:00
Digimer
b8bb781c5e * Added the new tools/anvil-cycle-vm-nics, which is the updated version for m2's cycle-vm-nics.pl.
* The RPM spec changes SELinux to 'permissive' (only for developmer, it will be removed before RC stage).

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-05-06 14:25:43 -04:00
Digimer
5f06752167 * Finished updating tools/anvil-prep-database to inject the new, local database entry into anvil.conf. This tool works again.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-05-01 12:26:41 -04:00
Digimer
a89fb24adf * Changed the Storage->copy() 'target' parameter to 'target_file' to avoid confusion with the often-used 'target' parameter for connecting to remote machines.
* Changed 'database::...' so that 'x' is now the database host's UUID instead of a simple integer. This will simplify sync'ing configs. Also removed default entries, and made it so that anvil-prep-database injects the local config during first setup. Renamed Database->get_local_id to get_local_uuid and changed the 'id' parameter to 'uuid'. Changed Database->initialize's 'id' parameter to 'host_uuid'. The Database->query, Database->write, Database->_mark_database_as_behind and Database->_find_behind_databases methods had their 'id' parameter changed to 'uuid'.
* Added the 'remote_user' parameter to Get->anvil_version, System->ping and System->change_shell_user_password for conencting to remote targets.
* Added the 'remote_user' parameter to all internal Remote->call uses.
* Updated Storage->backup, Storage->copy_file, Storage->make_directory,

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-04-30 11:43:30 -04:00
Digimer
eafd4fd3f7 * Fixed a couple bugs to get System->change_shell_user_password() working.
* Made logging between journald and a traditional file configurable via 'sys::log_file'. Also made the file handle unbuffered when logging to a file.
* Fixed a bug with loading the anvil.conf config file in a few locations.
* Created System->stty_echo() to handle enabling/disabling shell echo, and added restoring the echo to Tools->catch_sig.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-04-26 12:41:03 -04:00
Digimer
188cab5ec0 * Fixed a few bugs with how rsync is handled, specifically in the rsync wrapper script.
* Fixed a bug with handling ssh fingerprints (and removed comments going to the known_hosts file).
* Added more nested debug parameter passing when methods call other methods (though more work is needed to catch up)

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-04-24 13:32:19 -04:00
Digimer
ea43896fca * Created the new Remote module, and in it, moved System->remote_call to Remote->call() and created the new add_target_to_known_hosts() method (and two private helper methods). These are adapted from the m2 code.
* Updated Storage->read_file and Storage->write_file to support reading and writing on remote systems (untested though)
* Created System->change_shell_user_password() that changes a shell user's password by manually generating an sha512 salted hash of the given password and uses the resulting hash to modify the target user's password, so the password should never be visible in the process list. Works on both local and remote systems, though it still needs testing.
* Created Storage->rsync() to handle moving files between the local and a remote system.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-04-22 22:16:10 -04:00
Digimer
a294c6c4fa * Updated the database components to use the name 'anvil' and the user 'admin'. The 'database::user' and 'database::name' variables are still supported, but now hidden.
* Fixed a bug where some '$anvil->{}' variables should have been '$anvil->data->{}'.
* Started merging message keys on 'error_xxxx', 'warning_xxxx', etc.
* The anvil-configure-network now configures the network. Commented out, the tool can reconfigure the entire network without a reboot, but a current issue with the post-configured system refusing to use the allocated interface as the default gateway is to be reviewed at a future time. For now, a closing reboot will be issued.
* Started creating 'anvil-change-password' that will update passwords, including apache (and configure .htpasswd when needed).

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-04-13 19:55:34 -04:00
Digimer
e4f7bcf661 * Created Storage->backup() that makes a backup of the given file under the Anvil! backup directory with a time-stamped suffix and preserving the original directory path.
* Got anvil-configure-network writing out the new network config properly, but renaming already-active interfaces isn't working yet.
* Updated System->get_ips() to record the interface name of a given network by MAC address using 'sys::mac::<mac_address>::iface'.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-04-05 02:25:56 -04:00
Digimer
c88cbf4531 * Got tools/anvil-configure-network writing the first network config file body.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-04-03 01:00:46 -04:00
Digimer
d6846841a2 * Added the 'job_status' column to the 'jobs' table where progress to be shown to users is stored.
* Updated anvil-configure-network to use Database->insert_or_update_jobs().

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-04-02 01:03:28 -04:00
Digimer
d86750ba01 * Created System->hostname() to get and optionally set the hostname (static and pretty).
* Got anvil-configure-network setting the new hostname.
* Updated anvil-configure-network to exit only if the job was picked up by a still-running PID.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-04-01 02:26:38 -04:00