From e55594f58f599321849122c7f6fdf1a3d6c24c7e Mon Sep 17 00:00:00 2001 From: Digimer Date: Fri, 5 Jul 2019 01:36:21 -0400 Subject: [PATCH] * Notes updated with working network config for RHEL 8 proper. Two notes; Creating a BCN bridge by default, and switch the DR third octet to 12 (13 for IPMI) and fourth octet to sequence number. * Fixed a bug in System->get_ips() where DHCP-assigned IPs were not being parsed properly to get the default gateway. * Added the alteeve-el8-repo to the kickstart files install package list. * Updated anvil-daemon to sleep 2 seconds between loops, instead of 1. Added a check to 'check_firewall' to not run until after the system has been configured. * Quieted a lot of logging. Signed-off-by: Digimer --- Anvil/Tools/System.pm | 10 +- cgi-bin/striker | 2 +- html/skins/alteeve/pxe.txt | 11 +- notes | 228 +++++++++++++++++++++++++--- tools/anvil-daemon | 65 ++++---- tools/anvil-update-states | 14 +- tools/striker-manage-install-target | 45 +++--- 7 files changed, 282 insertions(+), 93 deletions(-) diff --git a/Anvil/Tools/System.pm b/Anvil/Tools/System.pm index c2e8cadb..c207b884 100644 --- a/Anvil/Tools/System.pm +++ b/Anvil/Tools/System.pm @@ -878,16 +878,18 @@ sub get_ips my $ip_route = $anvil->System->call({debug => $debug, shell_call => $anvil->data->{path}{exe}{ip}." route show"}); foreach my $line (split/\n/, $ip_route) { + $line = $anvil->Words->clean_spaces({ string => $line }); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { line => $line }}); - if ($line =~ /default via (.*?) dev (.*?) proto static metric (\d+)/i) + if ($line =~ /default via (.*?) dev (.*?) proto .*? metric (\d+)/i) { my $this_ip = $1; my $this_interface = $2; my $metric = $3; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { - this_ip => $this_ip, - this_interface => $this_interface, - metric => $metric, + 's1:this_ip' => $this_ip, + 's2:this_interface' => $this_interface, + 's3:metric' => $metric, + 's4:lowest_metric' => $lowest_metric, }}); if ($metric < $lowest_metric) diff --git a/cgi-bin/striker b/cgi-bin/striker index ce3a38d9..9ce1175f 100755 --- a/cgi-bin/striker +++ b/cgi-bin/striker @@ -1427,7 +1427,7 @@ ORDER BY # Get the list of current IPs so that we can warn the user if committing the changes will require # reconnecting. - $anvil->System->get_ips; + $anvil->System->get_ips({debug => 2}); my $matched_ip = 0; my $server_ip = $ENV{SERVER_ADDR}; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { server_ip => $server_ip }}); diff --git a/html/skins/alteeve/pxe.txt b/html/skins/alteeve/pxe.txt index 6cbda5f7..4c6c42a1 100644 --- a/html/skins/alteeve/pxe.txt +++ b/html/skins/alteeve/pxe.txt @@ -72,6 +72,7 @@ selinux --permissive %packages @^minimal-environment +alteeve-el8-repo %end @@ -102,16 +103,6 @@ rsync -av /tmp /mnt/sysimage/root/install_logs/ rsync -av /run/install /mnt/sysimage/root/install_logs/run/ rsync -av /var/log /mnt/sysimage/root/install_logs/var/ -### NOTE: This is only useful in the Alteeve labs. Replace with your own repo, or remove. -echo "Adding local repo" -cat > /mnt/sysimage/etc/yum.repos.d/rhel8.repo << EOF -[rhel8-repo] -name=RHEL 8 Repo on local network -baseurl=http://10.255.100.30/repo/ -enabled=1 -gpgcheck=0 -EOF - %end diff --git a/notes b/notes index 466041de..2f3f3e57 100644 --- a/notes +++ b/notes @@ -216,35 +216,223 @@ hosts: 10.41.20.2 m3-a02n02.sn 10.255.20.2 m3-a02n02.ifn -10.1.20.3 m3-a02dr01.bcn m3-a02dr01 m3-a02dr01.alteeve.com -10.41.20.3 m3-a02dr01.sn -10.255.20.3 m3-a02dr01.ifn +10.1.22.1 m3-a02dr01.bcn m3-a02dr01 m3-a02dr01.alteeve.com +10.41.22.1 m3-a02dr01.sn +10.255.22.1 m3-a02dr01.ifn ==== -Example Link config: -==== -==== - -Example Bonding config: -==== -BRIDGE_UUID="e7a8f977-560d-4a94-95cd-a1218f0fe890" -DEVICE="ifn1_bond1" -NAME="IFN 1 - Bond 1" -UUID="a59d138e-6c40-4366-b859-fcadafe577f4" -BONDING_OPTS="mode=active-backup primary=ifn1_link1 updelay=120000 downdelay=0 miimon=100 primary_reselect=better" +### Interface files +# +# Note: Insert the HWADDR's and update the IPs! +# +### BCN ####################################################################### +UUID=$(uuidgen) +cat > /etc/sysconfig/network-scripts/ifcfg-BCN_1_-_Link_1 << EOF +# Back-Channel Network 1 - Link 1 +HWADDR="" +UUID="${UUID}" +NAME="BCN 1 - Link 1" +DEVICE="bcn1_link1" +TYPE="Ethernet" +BOOTPROTO="none" +IPV6INIT="no" +ONBOOT="yes" +USERCTL="no" +MTU="1500" +NM_CONTROLLED="yes" +SLAVE="yes" +MASTER="bcn1_bond1" +ZONE="BCN1" +EOF + +UUID=$(uuidgen) +cat > /etc/sysconfig/network-scripts/ifcfg-BCN_1_-_Link_2 << EOF +# Back-Channel Network 1 - Link 2 +HWADDR="" +UUID="${UUID}" +NAME="BCN 1 - Link 2" +DEVICE="bcn1_link2" +TYPE="Ethernet" +BOOTPROTO="none" +IPV6INIT="no" +ONBOOT="yes" +USERCTL="no" +MTU="1500" +NM_CONTROLLED="yes" +SLAVE="yes" +MASTER="bcn1_bond1" +ZONE="BCN1" +EOF + +UUID=$(uuidgen) +cat > /etc/sysconfig/network-scripts/ifcfg-BCN_1_-_Bond_1 << EOF +# Back-Channel Network 1 - Bond 1 +UUID="${UUID}" +NAME="BCN 1 - Bond 1" +DEVICE="bcn1_bond1" +BRIDGE="bcn1_bridge1" +BONDING_OPTS="mode=active-backup primary=bcn1_link1 updelay=120000 downdelay=0 miimon=100 primary_reselect=better" +TYPE="Bond" +BONDING_MASTER="yes" +BOOTPROTO="none" +IPV6INIT="no" +ONBOOT="yes" +ZONE="BCN1" +EOF + +UUID=$(uuidgen) +cat > /etc/sysconfig/network-scripts/ifcfg-BCN_1_-_Bridge_1 << EOF +# Back-Channel Network 1 - Bridge 1 +UUID="${UUID}" +STP="yes" +BRIDGING_OPTS="priority=32768" +TYPE="Bridge" +BROWSER_ONLY="no" +NAME="BCN 1 - Bridge 1" +DEVICE="bcn1_bridge1" +ONBOOT="yes" +BOOTPROTO="none" +IPADDR="10.20.10.1" +PREFIX="16" +DEFROUTE="no" +ZONE="BCN1" +EOF + +### SN ######################################################################## +UUID=$(uuidgen) +cat > /etc/sysconfig/network-scripts/ifcfg-SN_1_-_Link_1 << EOF +# Storage Network 1 - Link 1 +HWADDR="" +UUID="${UUID}" +NAME="SN 1 - Link 1" +DEVICE="sn1_link1" +TYPE="Ethernet" +BOOTPROTO="none" +IPV6INIT="no" +ONBOOT="yes" +USERCTL="no" +MTU="1500" +NM_CONTROLLED="yes" +SLAVE="yes" +MASTER="sn1_bond1" +ZONE="SN1" +EOF + +UUID=$(uuidgen) +cat > /etc/sysconfig/network-scripts/ifcfg-SN_1_-_Link_2 << EOF +# Storage Network 1 - Link 2 +HWADDR="" +UUID="${UUID}" +NAME="SN 1 - Link 2" +DEVICE="sn1_link2" +TYPE="Ethernet" +BOOTPROTO="none" +IPV6INIT="no" +ONBOOT="yes" +USERCTL="no" +MTU="1500" +NM_CONTROLLED="yes" +SLAVE="yes" +MASTER="sn1_bond1" +ZONE="SN1" +EOF + +UUID=$(uuidgen) +cat > /etc/sysconfig/network-scripts/ifcfg-SN_1_-_Bond_1 << EOF +# Storage Network 1 - Bond 1 +UUID="${UUID}" +NAME="SN 1 - Bond 1" +DEVICE="sn1_bond1" +BONDING_OPTS="mode=active-backup primary=sn1_link1 updelay=120000 downdelay=0 miimon=100 primary_reselect=better" TYPE="Bond" BONDING_MASTER="yes" BOOTPROTO="none" IPV6INIT="no" ONBOOT="yes" +IPADDR="10.41.10.1" +PREFIX="16" DEFROUTE="no" +ZONE="SN1" +EOF + +### IFN ####################################################################### +UUID=$(uuidgen) +cat > /etc/sysconfig/network-scripts/ifcfg-IFN_1_-_Link_1 << EOF +# Internet-Facing Network 1 - Link 1 +HWADDR="" +UUID="${UUID}" +NAME="IFN 1 - Link 1" +DEVICE="ifn1_link1" +TYPE="Ethernet" +BOOTPROTO="none" +IPV6INIT="no" +ONBOOT="yes" +USERCTL="no" +MTU="1500" +NM_CONTROLLED="yes" +SLAVE="yes" +MASTER="ifn1_bond1" +ZONE="IFN1" +EOF + +UUID=$(uuidgen) +cat > /etc/sysconfig/network-scripts/ifcfg-IFN_1_-_Link_2 << EOF +# Internet-Facing Network 1 - Link 2 +HWADDR="" +UUID="${UUID}" +NAME="IFN 1 - Link 2" +DEVICE="ifn1_link2" +TYPE="Ethernet" +BOOTPROTO="none" +IPV6INIT="no" +ONBOOT="yes" +USERCTL="no" +MTU="1500" +NM_CONTROLLED="yes" +SLAVE="yes" +MASTER="ifn1_bond1" +ZONE="IFN1" +EOF + +UUID=$(uuidgen) +cat > /etc/sysconfig/network-scripts/ifcfg-IFN_1_-_Bond_1 << EOF +# Internet-Facing Network 1 - Bond 1 +UUID="${UUID}" +NAME="IFN 1 - Bond 1" +DEVICE="ifn1_bond1" BRIDGE="ifn1_bridge1" -ZONE=public -==== +BONDING_OPTS="mode=active-backup primary=ifn1_link1 updelay=120000 downdelay=0 miimon=100 primary_reselect=better" +TYPE="Bond" +BONDING_MASTER="yes" +BOOTPROTO="none" +IPV6INIT="no" +ONBOOT="yes" +MTU="1500" +ZONE="IFN1" +EOF + +UUID=$(uuidgen) +cat > /etc/sysconfig/network-scripts/ifcfg-IFN_1_-_Bridge_1 << EOF +# Internet-Facing Network 1 - Bridge 1 +UUID="${UUID}" +STP="yes" +BRIDGING_OPTS="priority=32768" +TYPE="Bridge" +BROWSER_ONLY="no" +NAME="IFN 1 - Bridge 1" +DEVICE="ifn1_bridge1" +ONBOOT="yes" +BOOTPROTO="none" +IPADDR="10.255.10.1" +PREFIX="16" +GATEWAY="10.255.255.254" +DNS1="8.8.8.8" +DNS2="8.8.4.4" +DEFROUTE="yes" +ZONE="IFN1" +EOF -Example Bridge config: -===== -===== +==== ======= virt-manager stores information in dconf-editor -> /org/virt-manager/virt-manager/connections ($HOME/.config/dconf/user) @@ -330,7 +518,7 @@ subscription-manager repos --enable rhel-8-for-x86_64-supplementary-rpms subscription-manager repos --enable rhel-8-for-x86_64-supplementary-source-rpms subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-source-rpms ----- +# ---- subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-source-rpms subscription-manager repos --enable rhel-8-for-x86_64-supplementary-source-rpms subscription-manager repos --enable rhel-8-for-x86_64-baseos-rpms diff --git a/tools/anvil-daemon b/tools/anvil-daemon index 2a4d0f4f..0173c335 100755 --- a/tools/anvil-daemon +++ b/tools/anvil-daemon @@ -72,7 +72,7 @@ $anvil->Log->secure({set => 1}); # Connect to the database(s). If we have no connections, we'll proceed anyway as one of the 'run_once' tasks # is to setup the database server. $anvil->Database->connect({debug => 3, check_if_configured => 1}); -$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, secure => 0, key => "log_0132"}); +$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, secure => 0, key => "log_0132"}); # If I have no databases, sleep for a second and then exit (systemd will restart us). if (not $anvil->data->{sys}{database}{connections}) @@ -117,7 +117,7 @@ $anvil->Storage->record_md5sums; # Disconnect. We'll reconnect inside the loop $anvil->Database->disconnect(); -$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, secure => 0, key => "log_0203"}); +$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, secure => 0, key => "log_0203"}); # This will prevent restarting while jobs are running. $anvil->data->{sys}{jobs_running} = 0; @@ -131,7 +131,7 @@ $anvil->data->{timing}{minute_checks} = 60; $anvil->data->{timing}{repo_update_interval} = 86400; $anvil->data->{timing}{next_minute_check} = $now_time - 1; $anvil->data->{timing}{next_repo_check} = $now_time; # We want to run on daemon startup -$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { +$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "s1:timing::minute_checks" => $anvil->data->{timing}{minute_checks}, "s2:timing::repo_update_interval" => $anvil->data->{timing}{repo_update_interval}, "s3:now_time" => $now_time, @@ -153,7 +153,7 @@ while(1) $anvil->Get->switches; # Re-read to let switches override again. $anvil->Words->read(); $anvil->Database->connect({check_if_configured => $check_if_database_is_configured}); - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, secure => 0, key => "log_0132"}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, secure => 0, key => "log_0132"}); # Mark that we don't want to check the database now. $check_if_database_is_configured = 0; @@ -181,7 +181,7 @@ while(1) # Disconnect from the database(s) and sleep now. $anvil->Database->disconnect(); - sleep(1); + sleep(2); } $anvil->nice_exit({code => 0}); @@ -229,7 +229,7 @@ sub handle_periodic_tasks # Update the next check time. $anvil->data->{timing}{next_minute_check} = $now_time + $anvil->data->{timing}{minute_checks}; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { "s1:timing::minute_checks" => $anvil->data->{timing}{minute_checks}, "s2:timing::next_minute_check" => $anvil->data->{timing}{next_minute_check}, }}); @@ -286,11 +286,11 @@ sub handle_periodic_tasks job_description => "job_0017", job_progress => 0, }); - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, list => { job_uuid => $job_uuid }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { job_uuid => $job_uuid }}); # Update the next check time. $anvil->data->{timing}{next_repo_check} = $now_time + $anvil->data->{timing}{repo_update_interval}; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, list => { + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { "s1:timing::repo_update_interval" => $anvil->data->{timing}{repo_update_interval}, "s2:timing::next_repo_check" => $anvil->data->{timing}{next_repo_check}, }}); @@ -468,7 +468,7 @@ sub check_ssh_keys { $update_known_hosts = 1; $known_hosts_new_lines .= $test_line."\n"; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { 's1:update_known_hosts' => $update_known_hosts, 's2:known_hosts_new_lines' => $known_hosts_new_lines, }}); @@ -591,7 +591,7 @@ sub check_ssh_keys $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { update_authorized_keys => $update_authorized_keys }}); if ($update_authorized_keys) { - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0273", variables => { user => $user, file => $authorized_keys_file }}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, key => "log_0273", variables => { user => $user, file => $authorized_keys_file }}); if (-e $authorized_keys_file) { my $backup_file = $anvil->Storage->backup({ @@ -599,10 +599,10 @@ sub check_ssh_keys fatal => 1, file => $authorized_keys_file, }); - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { backup_file => $backup_file }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { backup_file => $backup_file }}); if (-e $backup_file) { - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0154", variables => { source_file => $authorized_keys_file, target_file => $backup_file }}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, key => "log_0154", variables => { source_file => $authorized_keys_file, target_file => $backup_file }}); } else { @@ -618,7 +618,7 @@ sub check_ssh_keys group => $user, mode => "0644", }); - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { failed => $failed }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { failed => $failed }}); } } @@ -758,15 +758,15 @@ sub check_install_target my $status = "unavailable"; my $output = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{'striker-manage-install-target'}." --status --check --no-refresh"}); - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { output => $output }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { output => $output }}); foreach my $line (split/\n/, $output) { - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { line => $line }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { line => $line }}); if ($line =~ /status=(\d)/) { my $digit = $1; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { digit => $digit }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { digit => $digit }}); if ($digit == 0) { @@ -776,7 +776,7 @@ sub check_install_target { $status = "enabled"; } - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { status => $status }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { status => $status }}); last; } } @@ -822,10 +822,17 @@ sub run_once sub check_firewall { my ($anvil) = @_; - + + # Don't call this if we're not configured yet. + my $configured = $anvil->System->check_if_configured({debug => 2}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, list => { configured => $configured }}); + # Check the firewall needs to be updated. - my $output = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{'anvil-manage-firewall'}}); - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { output => $output }}); + if ($configured) + { + my $output = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{'anvil-manage-firewall'}}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { output => $output }}); + } return(0); } @@ -942,7 +949,7 @@ sub keep_running { # If it's not a handle, delete it. my $running = $anvil->data->{jobs}{handles}{$job_uuid}->poll(); - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { "jobs::handles::${job_uuid}" => $anvil->data->{jobs}{handles}{$job_uuid}, running => $running, }}); @@ -966,7 +973,7 @@ sub keep_running # Update hardware state files if the system isn't configured. Running it always is too intensive. my $configured = $anvil->System->check_if_configured; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { configured => $configured }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { configured => $configured }}); if (not $configured) { update_state_file($anvil); @@ -1055,7 +1062,7 @@ sub run_jobs if ((not exists $anvil->data->{lost_job_count}{$job_uuid}) or (not defined $anvil->data->{lost_job_count}{$job_uuid})) { $anvil->data->{lost_job_count}{$job_uuid} = 0; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "lost_job_count::${job_uuid}" => $anvil->data->{lost_job_count}{$job_uuid} }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { "lost_job_count::${job_uuid}" => $anvil->data->{lost_job_count}{$job_uuid} }}); } if ($anvil->data->{lost_job_count}{$job_uuid} > 5) { @@ -1069,7 +1076,7 @@ sub run_jobs # Clear some variables. $job_progress = 0; $job_status = "message_0056"; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { job_progress => $job_progress, job_status => $job_status, }}); @@ -1077,12 +1084,12 @@ sub run_jobs # Clear the job. $anvil->Job->clear({debug => 3, job_uuid => $job_uuid}); $anvil->data->{lost_job_count}{$job_uuid} = 0; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "lost_job_count::${job_uuid}" => $anvil->data->{lost_job_count}{$job_uuid} }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { "lost_job_count::${job_uuid}" => $anvil->data->{lost_job_count}{$job_uuid} }}); } else { $anvil->data->{lost_job_count}{$job_uuid}++; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "lost_job_count::${job_uuid}" => $anvil->data->{lost_job_count}{$job_uuid} }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { "lost_job_count::${job_uuid}" => $anvil->data->{lost_job_count}{$job_uuid} }}); } } @@ -1147,7 +1154,7 @@ sub run_jobs my $command = $job_command." --job-uuid ".$job_uuid; $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, secure => 0, key => "log_0210", variables => { command => $command }}); $anvil->data->{jobs}{handles}{$job_uuid} = $anvil->System->call({ - debug => 2, + debug => 3, background => 1, stdout_file => "/tmp/anvil.job.".$job_uuid.".stdout", stderr_file => "/tmp/anvil.job.".$job_uuid.".stderr", @@ -1155,11 +1162,11 @@ sub run_jobs source => $THIS_FILE, line => __LINE__, }); - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "jobs::handles::${job_uuid}" => $anvil->data->{jobs}{handles}{$job_uuid} }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { "jobs::handles::${job_uuid}" => $anvil->data->{jobs}{handles}{$job_uuid} }}); # Log the PID (the job should update the database). my $pid = $anvil->data->{jobs}{handles}{$job_uuid}->pid(); - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { pid => $pid }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { pid => $pid }}); } } diff --git a/tools/anvil-update-states b/tools/anvil-update-states index b035db22..0ef8c834 100755 --- a/tools/anvil-update-states +++ b/tools/anvil-update-states @@ -93,7 +93,7 @@ sub update_network $duplex =~ s/\n$//; $operational =~ s/\n$//; $speed =~ s/\n$//; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { interface => $interface, speed => $speed, mac_address => $mac_address, @@ -115,7 +115,7 @@ sub update_network { $ip_address = $anvil->data->{sys}{network}{interface}{$interface}{ip} ? $anvil->data->{sys}{network}{interface}{$interface}{ip} : ""; $subnet_mask = $anvil->data->{sys}{network}{interface}{$interface}{subnet} ? $anvil->data->{sys}{network}{interface}{$interface}{subnet} : ""; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { ip_address => $ip_address, subnet_mask => $subnet_mask, }}); @@ -129,7 +129,7 @@ sub update_network # It's a slave. $mac_address = $anvil->Storage->read_file({file => $mac_bond_file}); $mac_address =~ s/\n$//; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { mac_address => $mac_address }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { mac_address => $mac_address }}); } # If this is a virtual interface, set some fake values that don't actually exist on @@ -140,7 +140,7 @@ sub update_network # Speed is "as fast as possible", so we'll record 100 Gbps, but that is really kind of arbitrary. $speed = 100000 if ((not $speed) or ($speed eq "-1")); $duplex = "full" if not $duplex; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { speed => $speed, duplex => $duplex, }}); @@ -149,7 +149,7 @@ sub update_network if (not $link_state) { $speed = 0; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { speed => $speed }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { speed => $speed }}); } # Is this a bond interface? @@ -176,7 +176,7 @@ sub update_network $mii_polling_interval =~ s/\n$//; $up_delay =~ s/\n$//; $down_delay =~ s/\n$//; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { active_slave => $active_slave, bond_mode => $bond_mode, mii_polling_interval => $mii_polling_interval, @@ -271,7 +271,7 @@ sub update_network type => $type, up_delay => $up_delay, }; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { "network::interfaces::by_name::${interface}::active_slave" => $anvil->data->{network}{interfaces}{by_name}{$interface}{active_slave}, "network::interfaces::by_name::${interface}::bond_mode" => $anvil->data->{network}{interfaces}{by_name}{$interface}{bond_mode}, "network::interfaces::by_name::${interface}::bond_master" => $anvil->data->{network}{interfaces}{by_name}{$interface}{bond_master}, diff --git a/tools/striker-manage-install-target b/tools/striker-manage-install-target index b5c8a545..c688e104 100755 --- a/tools/striker-manage-install-target +++ b/tools/striker-manage-install-target @@ -78,7 +78,7 @@ $anvil->data->{switches}{'no-refresh'} = 0; $anvil->data->{switches}{refresh} = 0; $anvil->data->{switches}{status} = ""; $anvil->Get->switches(); -$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { +$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { 'switches::check' => $anvil->data->{switches}{check}, 'switches::disable' => $anvil->data->{switches}{disable}, 'switches::enable' => $anvil->data->{switches}{enable}, @@ -102,7 +102,7 @@ if (($< != 0) && ($> != 0)) if ($anvil->data->{switches}{status}) { my $dhcpd_running = $anvil->System->check_daemon({daemon => $anvil->data->{sys}{daemon}{dhcpd}}); - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { dhcpd_running => $dhcpd_running }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { dhcpd_running => $dhcpd_running }}); if ($dhcpd_running) { print $anvil->Words->string({key => "message_0123"})."\n"; @@ -141,7 +141,7 @@ if ($anvil->data->{switches}{disable}) my $exit_code = 0; my $job_message = "message_0125"; my $return_code = $anvil->System->stop_daemon({daemon => $anvil->data->{sys}{daemon}{dhcpd}}); - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { return_code => $return_code }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { return_code => $return_code }}); if ($return_code) { # non-0 means something went wrong. @@ -222,7 +222,7 @@ if ($anvil->data->{switches}{enable}) my $exit_code = 0; my $job_message = "message_0127"; my $return_code = $anvil->System->start_daemon({daemon => $anvil->data->{sys}{daemon}{dhcpd}}); - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { return_code => $return_code }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { return_code => $return_code }}); if ($return_code) { # non-0 means something went wrong. @@ -302,10 +302,10 @@ sub check_refresh # Setup the packages directory $anvil->data->{path}{directories}{packages} = "/var/www/html/".$anvil->data->{host_os}{os_type}."/".$anvil->data->{host_os}{os_arch}."/os/Packages"; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "path::directories::packages" => $anvil->data->{path}{directories}{packages} }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { "path::directories::packages" => $anvil->data->{path}{directories}{packages} }}); # Default to 'no' - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { "switches::refresh" => $anvil->data->{switches}{refresh}, "switches::force" => $anvil->data->{switches}{force}, }}); @@ -324,13 +324,13 @@ sub check_refresh # If it's been disabled in anvil.conf, exit. $anvil->data->{'install-manifest'}{'refresh-packages'} = 1 if not defined $anvil->data->{'install-manifest'}{'refresh-packages'}; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "install-manifest::refresh-packages" => $anvil->data->{'install-manifest'}{'refresh-packages'} }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { "install-manifest::refresh-packages" => $anvil->data->{'install-manifest'}{'refresh-packages'} }}); if (not $anvil->data->{'install-manifest'}{'refresh-packages'}) { # We're out. $anvil->data->{switches}{refresh} = 0; print $anvil->Words->string({key => "log_0235"})."\n"; - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0235"}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, key => "log_0235"}); return(0); } @@ -340,8 +340,8 @@ sub check_refresh # Source isn't configured, set it up $anvil->data->{switches}{refresh} = 1; print $anvil->Words->string({key => "log_0237"})."\n"; - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0237"}); - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "switches::refresh" => $anvil->data->{switches}{refresh} }}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, key => "log_0237"}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { "switches::refresh" => $anvil->data->{switches}{refresh} }}); return(0); } @@ -351,7 +351,7 @@ sub check_refresh variable_source_uuid => $anvil->Get->host_uuid, variable_source_table => "hosts", }); - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { unixtime => $unixtime, variable_uuid => $variable_uuid, modified_date => $modified_date, @@ -360,7 +360,7 @@ sub check_refresh if (($unixtime eq "") or ($unixtime =~ /\D/)) { $unixtime = 0; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { unixtime => $unixtime }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { unixtime => $unixtime }}); } ### TODO: Allow the user to set a "refresh time" that will wait until the local time is after a @@ -369,20 +369,20 @@ sub check_refresh # refresh. $anvil->data->{'install-manifest'}{'refresh-period'} = 86400 if not defined $anvil->data->{'install-manifest'}{'refresh-period'}; $anvil->data->{'install-manifest'}{'refresh-period'} =~ s/,//g; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { 'install-manifest::refresh-period' => $anvil->data->{'install-manifest'}{'refresh-period'}, }}); if ($anvil->data->{'install-manifest'}{'refresh-period'} =~ /\D/) { $anvil->data->{'install-manifest'}{'refresh-period'} = 86400; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { 'install-manifest::refresh-period' => $anvil->data->{'install-manifest'}{'refresh-period'}, }}); } my $time_now = time; my $next_scan = $unixtime + $anvil->data->{'install-manifest'}{'refresh-period'}; my $difference = ($next_scan - $time_now); - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { 's1:time_now' => $time_now, 's2:next_scan' => $next_scan, 's3:difference' => $difference, @@ -393,7 +393,7 @@ sub check_refresh $anvil->data->{switches}{refresh} = 1; my $variables = { seconds => $anvil->Convert->add_commas({number => $anvil->data->{'install-manifest'}{'refresh-period'}}) }; print $anvil->Words->string({key => "log_0239", variables => $variables})."\n"; - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0239", variables => $variables}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, key => "log_0239", variables => $variables}); return(0); } elsif ($difference > 0) @@ -402,7 +402,7 @@ sub check_refresh $anvil->data->{switches}{refresh} = 0; my $variables = { next_refresh => $anvil->Convert->add_commas({number => $difference}) }; print $anvil->Words->string({key => "log_0236", variables => $variables})."\n"; - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0236", variables => $variables}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, key => "log_0236", variables => $variables}); } # If the refresh fails, we'll update the last unixtime to be 24 hours from now, so that we can try @@ -411,13 +411,13 @@ sub check_refresh if ($unixtime =~ /^\d+$/) { $anvil->data->{sys}{retry_time} = $unixtime + 86400; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "sys::retry_time" => $anvil->data->{sys}{retry_time} }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { "sys::retry_time" => $anvil->data->{sys}{retry_time} }}); } else { # No previous time, so start with the current time $anvil->data->{sys}{retry_time} = time; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "sys::retry_time" => $anvil->data->{sys}{retry_time} }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { "sys::retry_time" => $anvil->data->{sys}{retry_time} }}); } return(0); @@ -855,7 +855,7 @@ sub check_alteeve_repo ### TODO: Remove this and the check when the signed el8 repo is ready $repo_file = "/etc/yum.repos.d/alteeve-el".$anvil->data->{host_os}{version}.".repo"; $repo_url = "https://alteeve.com/an-repo/el".$anvil->data->{host_os}{version}."b/alteeve-el".$anvil->data->{host_os}{version}."b-repo-latest.noarch.rpm"; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { repo_file => $repo_file, repo_url => $repo_url, }}); @@ -865,7 +865,7 @@ sub check_alteeve_repo ### TODO: Update this when rhel8 is out $repo_file = "/etc/yum.repos.d/alteeve-el".$anvil->data->{host_os}{version}."b.repo"; $repo_url = "https://alteeve.com/an-repo/el".$anvil->data->{host_os}{version}."/alteeve-el".$anvil->data->{host_os}{version}."-repo-latest.noarch.rpm"; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { repo_file => $repo_file, repo_url => $repo_url, }}); @@ -876,7 +876,7 @@ sub check_alteeve_repo { # Install the repo my $handle = $anvil->System->call({debug => 2, shell_call => $anvil->data->{path}{exe}{rpm}." -Uvh ".$repo_url }); - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { handle => $handle }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { handle => $handle }}); } # If it still doesn't exist, we're done. @@ -1125,6 +1125,7 @@ sub load_packages "adwaita-gtk2-theme.x86_64", "adwaita-icon-theme.noarch", "alsa-lib.x86_64", + "alteeve-el8-repo.noarch", "anvil-core.noarch", "anvil-dr.noarch", "anvil-node.noarch",