* Updated remainder pointers to the old repos to the new repos. Added support for the new alteeve-repo-setup.

* Removed the checks for resync that limited resyncs on jobs and variables tables. That approach to minimize unnecessary resyncshas proven faulty, will find another way later.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 4 years ago
parent 667eaa67fe
commit 42ffc200bc
  1. 5
      Anvil/Tools.pm
  2. 7
      Anvil/Tools/Database.pm
  3. 2
      html/skins/alteeve/pxe.txt
  4. 2
      tools/striker-auto-initialize-all
  5. 49
      tools/striker-initialize-host
  6. 30
      tools/striker-manage-install-target

@ -1017,7 +1017,7 @@ sub _set_paths
# Executables # Executables
$anvil->data->{path} = { $anvil->data->{path} = {
configs => { configs => {
'alteeve-el8.repo' => "/etc/yum.repos.d/alteeve-el8.repo", 'alteeve-release.repo' => "/etc/yum.repos.d/alteeve-release.repo",
'anvil.conf' => "/etc/anvil/anvil.conf", 'anvil.conf' => "/etc/anvil/anvil.conf",
'anvil.version' => "/etc/anvil/anvil.version", 'anvil.version' => "/etc/anvil/anvil.version",
'autoindex.conf' => "/etc/httpd/conf.d/autoindex.conf", 'autoindex.conf' => "/etc/httpd/conf.d/autoindex.conf",
@ -1090,7 +1090,7 @@ sub _set_paths
units => "/usr/lib/systemd/system", units => "/usr/lib/systemd/system",
}, },
exe => { exe => {
ocf_alteeve => "/usr/lib/ocf/resource.d/alteeve/server", 'alteeve-repo-setup' => "/usr/sbin/alteeve-repo-setup",
'anvil-boot-server' => "/usr/sbin/anvil-boot-server", 'anvil-boot-server' => "/usr/sbin/anvil-boot-server",
'anvil-change-password' => "/usr/sbin/anvil-change-password", 'anvil-change-password' => "/usr/sbin/anvil-change-password",
'anvil-check-memory' => "/usr/sbin/anvil-check-memory", 'anvil-check-memory' => "/usr/sbin/anvil-check-memory",
@ -1179,6 +1179,7 @@ sub _set_paths
mv => "/usr/bin/mv", mv => "/usr/bin/mv",
nmap => "/usr/bin/nmap", nmap => "/usr/bin/nmap",
nmcli => "/bin/nmcli", nmcli => "/bin/nmcli",
ocf_alteeve => "/usr/lib/ocf/resource.d/alteeve/server",
openssl => "/usr/bin/openssl", openssl => "/usr/bin/openssl",
'osinfo-query' => "/usr/bin/osinfo-query", 'osinfo-query' => "/usr/bin/osinfo-query",
passwd => "/usr/bin/passwd", passwd => "/usr/bin/passwd",

@ -16116,13 +16116,6 @@ ORDER BY
"s3:sys::database::table::${table}::uuid::${uuid}::row_count" => $anvil->data->{sys}{database}{table}{$table}{uuid}{$uuid}{row_count}, "s3:sys::database::table::${table}::uuid::${uuid}::row_count" => $anvil->data->{sys}{database}{table}{$table}{uuid}{$uuid}{row_count},
}}); }});
if ((($table eq "jobs") or ($table eq "variables")) && ($difference < 10))
{
# These often fall out of sync and trigger resyncs when in fact it
# was just a change that happened between counting columns.
next;
}
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, priority => "alert", key => "log_0219", variables => { $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, priority => "alert", key => "log_0219", variables => {
missing => $difference, missing => $difference,
table => $table, table => $table,

@ -82,7 +82,7 @@ selinux --permissive
%packages %packages
@^minimal-environment @^minimal-environment
#alteeve-el8-repo #alteeve-release
#createrepo #createrepo
#dhcp-server #dhcp-server
#firefox #firefox

@ -326,6 +326,7 @@ sub configure_machine_networks
} }
my ($job_uuid) = $anvil->Database->insert_or_update_jobs({ my ($job_uuid) = $anvil->Database->insert_or_update_jobs({
debug => 2,
job_host_uuid => $machine_host_uuid, job_host_uuid => $machine_host_uuid,
job_command => $anvil->data->{path}{exe}{'anvil-configure-host'}.$anvil->Log->switches, job_command => $anvil->data->{path}{exe}{'anvil-configure-host'}.$anvil->Log->switches,
job_data => "form::config_step2", job_data => "form::config_step2",
@ -334,7 +335,6 @@ sub configure_machine_networks
job_description => "job_0071", job_description => "job_0071",
job_progress => 0, job_progress => 0,
}); });
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { job_uuid => $job_uuid }});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0266", variables => { $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0266", variables => {
host_name => $host_name, host_name => $host_name,
job_uuid => $job_uuid, job_uuid => $job_uuid,

@ -59,6 +59,7 @@ set_host_name($anvil);
add_repos($anvil); add_repos($anvil);
configure_lvm($anvil); configure_lvm($anvil);
add_databases($anvil); add_databases($anvil);
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, 'print' => 1, key => "job_0047"});
update_progress($anvil, 100, "job_0047"); update_progress($anvil, 100, "job_0047");
$anvil->nice_exit({exit_code => 0}); $anvil->nice_exit({exit_code => 0});
@ -371,9 +372,31 @@ sub add_repos
update_progress($anvil, $anvil->data->{job}{progress}, "job_0028"); update_progress($anvil, $anvil->data->{job}{progress}, "job_0028");
# Add the local repo. # Add the local repo.
my $repo = $anvil->Striker->get_local_repo({debug => 3}); my $repo = $anvil->Striker->get_local_repo({debug => 2});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { repo => $repo }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { repo => $repo }});
# If this striker is an enterprise user, get the key for when we initialize targets.
my $enterprise_key = "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"path::configs::alteeve-release.repo" => $anvil->data->{path}{configs}{'alteeve-release.repo'},
}});
if (-e $anvil->data->{path}{configs}{'alteeve-release.repo'})
{
# Read the file
my $alteeve_repo = $anvil->Storage->read_file({file => $anvil->data->{path}{configs}{'alteeve-release.repo'}});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { alteeve_repo => $alteeve_repo }});
foreach my $line (split/\n/, $alteeve_repo)
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { line => $line }});
if ($line =~ /baseurl=.*?\/enterprise\/.*?\/(.*?)\//)
{
$enterprise_key = $1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { enterprise_key => $enterprise_key }});
last;
}
}
}
if ($repo) if ($repo)
{ {
# NOTE: We can't use Storage->write_file() because the target may not have 'rsync' installed # NOTE: We can't use Storage->write_file() because the target may not have 'rsync' installed
@ -612,7 +635,6 @@ EOF
# If this is a CentOS Stream OS, enable the HA repo. # If this is a CentOS Stream OS, enable the HA repo.
my ($os_type, $os_arch) = $anvil->Get->os_type({ my ($os_type, $os_arch) = $anvil->Get->os_type({
debug => 2,
password => $anvil->data->{data}{password}, password => $anvil->data->{data}{password},
port => $anvil->data->{data}{ssh_port}, port => $anvil->data->{data}{ssh_port},
target => $anvil->data->{data}{host_ip_address}, target => $anvil->data->{data}{host_ip_address},
@ -728,7 +750,7 @@ EOF
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { line => $line }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { line => $line }});
next if $line =~ /anvil-core/; next if $line =~ /anvil-core/;
if ($line =~ /alteeve.*repo.noarch/) if ($line =~ /alteeve-release.noarch/)
{ {
$alteeve_repo = 1; $alteeve_repo = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { alteeve_repo => $alteeve_repo }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { alteeve_repo => $alteeve_repo }});
@ -785,6 +807,27 @@ EOF
error => $error, error => $error,
return_code => $return_code, return_code => $return_code,
}}); }});
# If successful, we now need to configure the repo.
$shell_call = $anvil->data->{path}{exe}{'alteeve-repo-setup'}." --yes";
if ($enterprise_key)
{
$shell_call = $anvil->data->{path}{exe}{'alteeve-repo-setup'}." --key ".$enterprise_key." --yes";
}
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { shell_call => $shell_call }});
($output, $error, $return_code) = $anvil->Remote->call({
debug => 2,
shell_call => $shell_call,
password => $anvil->data->{data}{password},
port => $anvil->data->{data}{ssh_port},
target => $anvil->data->{data}{host_ip_address},
remote_user => "root",
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
output => $output,
error => $error,
return_code => $return_code,
}});
} }
} }
} }

@ -939,36 +939,22 @@ sub check_alteeve_repo
{ {
my ($anvil) = @_; my ($anvil) = @_;
my $repo_url = ""; my $repo_file = "/etc/yum.repos.d/alteeve-anvil.repo";
my $repo_file = ""; my $repo_url = "https://www.alteeve.com/an-repo/m3/anvil-release-latest.noarch.rpm";
### NOTE: This adds 'b' for the beta repo
if (1)
{
### 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 => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => {
repo_file => $repo_file, repo_file => $repo_file,
repo_url => $repo_url, repo_url => $repo_url,
}}); }});
}
else
{
### 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 => 3, list => {
repo_file => $repo_file,
repo_url => $repo_url,
}});
}
# If the repo file doesn't exist, try to install it. # If the repo file doesn't exist, try to install it.
if (not -e $repo_file) if (not -e $repo_file)
{ {
# Install the repo # Install the repo
my ($handle, $return_code) = $anvil->System->call({debug => 2, shell_call => $anvil->data->{path}{exe}{rpm}." -Uvh ".$repo_url }); my ($output, $return_code) = $anvil->System->call({debug => 2, shell_call => $anvil->data->{path}{exe}{dnf}." -y install ".$repo_url });
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { handle => $handle, return_code => $return_code }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
output => $output,
return_code => $return_code,
}});
} }
# If it still doesn't exist, we're done. # If it still doesn't exist, we're done.
@ -1489,7 +1475,7 @@ sub load_packages
"adwaita-gtk2-theme.x86_64", "adwaita-gtk2-theme.x86_64",
"adwaita-icon-theme.noarch", "adwaita-icon-theme.noarch",
"alsa-lib.x86_64", "alsa-lib.x86_64",
"alteeve-el8-repo.noarch", "alteeve-release.noarch",
"annobin.x86_64", "annobin.x86_64",
"anvil-core.noarch", "anvil-core.noarch",
"anvil-dr.noarch", "anvil-dr.noarch",

Loading…
Cancel
Save