From 14aae6eb186c1a1cc71dd9f9f1eff1bc4c603ea2 Mon Sep 17 00:00:00 2001 From: James Adams Date: Thu, 5 Sep 2024 16:36:20 +0100 Subject: [PATCH] ncm-pbsknownhosts: Remove obsolete component --- ncm-pbsknownhosts/ChangeLog | 3 - ncm-pbsknownhosts/pom.xml | 65 ------ .../pbsknownhosts/config-common.pan | 17 -- .../components/pbsknownhosts/config-rpm.pan | 16 -- .../pan/components/pbsknownhosts/config.pan | 8 - .../pan/components/pbsknownhosts/schema.pan | 25 --- .../src/main/perl/pbsknownhosts.pm | 187 ------------------ .../src/main/perl/pbsknownhosts.pod | 72 ------- ncm-pbsknownhosts/src/test/perl/00-load.t | 18 -- ncm-pbsknownhosts/src/test/perl/pod-syntax.t | 6 - ncm-pbsknownhosts/src/test/resources/ccm.cfg | 6 - pom.xml | 1 - 12 files changed, 424 deletions(-) delete mode 100644 ncm-pbsknownhosts/ChangeLog delete mode 100644 ncm-pbsknownhosts/pom.xml delete mode 100644 ncm-pbsknownhosts/src/main/pan/components/pbsknownhosts/config-common.pan delete mode 100644 ncm-pbsknownhosts/src/main/pan/components/pbsknownhosts/config-rpm.pan delete mode 100644 ncm-pbsknownhosts/src/main/pan/components/pbsknownhosts/config.pan delete mode 100755 ncm-pbsknownhosts/src/main/pan/components/pbsknownhosts/schema.pan delete mode 100755 ncm-pbsknownhosts/src/main/perl/pbsknownhosts.pm delete mode 100755 ncm-pbsknownhosts/src/main/perl/pbsknownhosts.pod delete mode 100644 ncm-pbsknownhosts/src/test/perl/00-load.t delete mode 100644 ncm-pbsknownhosts/src/test/perl/pod-syntax.t delete mode 100644 ncm-pbsknownhosts/src/test/resources/ccm.cfg diff --git a/ncm-pbsknownhosts/ChangeLog b/ncm-pbsknownhosts/ChangeLog deleted file mode 100644 index 386a64a8..00000000 --- a/ncm-pbsknownhosts/ChangeLog +++ /dev/null @@ -1,3 +0,0 @@ -2010-10-01 (Version 1.0.0) -- B. Gamma - - Initial version of component. diff --git a/ncm-pbsknownhosts/pom.xml b/ncm-pbsknownhosts/pom.xml deleted file mode 100644 index 8febd2f3..00000000 --- a/ncm-pbsknownhosts/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - 4.0.0 - - org.quattor.cfg.module - pbsknownhosts - - pom - 23.9.0-rc2-SNAPSHOT - pbsknownhosts NCM component. - - - org.quattor.maven - build-profile - 1.62 - - - - - - Apache 2 License - http://www.opensource.org/licenses/apache2.0 - Copyright (c) Responsible Organization - - - - - - Charles Loomis - charles.loomis@cern.ch - - - - - - Jane SMITH - smith@example.com - - author - - - - Joe DOE - doe@example.org - - author - - - - - - - - - org.codehaus.mojo - rpm-maven-plugin - - https://github.com/quattor/configuration-modules-grid/tree/master/ncm-${project.artifactId} - - - - - - - diff --git a/ncm-pbsknownhosts/src/main/pan/components/pbsknownhosts/config-common.pan b/ncm-pbsknownhosts/src/main/pan/components/pbsknownhosts/config-common.pan deleted file mode 100644 index b17f3c02..00000000 --- a/ncm-pbsknownhosts/src/main/pan/components/pbsknownhosts/config-common.pan +++ /dev/null @@ -1,17 +0,0 @@ -# ${license-info} -# ${developer-info} -# ${author-info} -# ${build-info} - -unique template components/${project.artifactId}/config-common; - -include 'components/${project.artifactId}/schema'; - -# Set prefix to root of component configuration. -prefix '/software/components/${project.artifactId}'; - -'version' = '${no-snapshot-version}'; -#'package' = 'NCM::Component'; - -'active' ?= true; -'dispatch' ?= true; diff --git a/ncm-pbsknownhosts/src/main/pan/components/pbsknownhosts/config-rpm.pan b/ncm-pbsknownhosts/src/main/pan/components/pbsknownhosts/config-rpm.pan deleted file mode 100644 index e73eef2a..00000000 --- a/ncm-pbsknownhosts/src/main/pan/components/pbsknownhosts/config-rpm.pan +++ /dev/null @@ -1,16 +0,0 @@ -# ${license-info} -# ${developer-info} -# ${author-info} -# ${build-info} - -unique template components/${project.artifactId}/config-rpm; - -include 'components/${project.artifactId}/config-common'; - -# Set prefix to root of component configuration. -prefix '/software/components/${project.artifactId}'; - -# Install Quattor configuration module via RPM package. -'/software/packages' = pkg_repl('ncm-${project.artifactId}', '${no-snapshot-version}-${rpm.release}', 'noarch'); -'dependencies/pre' ?= list('spma'); - diff --git a/ncm-pbsknownhosts/src/main/pan/components/pbsknownhosts/config.pan b/ncm-pbsknownhosts/src/main/pan/components/pbsknownhosts/config.pan deleted file mode 100644 index 4625b0f8..00000000 --- a/ncm-pbsknownhosts/src/main/pan/components/pbsknownhosts/config.pan +++ /dev/null @@ -1,8 +0,0 @@ -# ${license-info} -# ${developer-info} -# ${author-info} -# ${build-info} - -unique template components/${project.artifactId}/config; - -include 'components/${project.artifactId}/config-rpm'; diff --git a/ncm-pbsknownhosts/src/main/pan/components/pbsknownhosts/schema.pan b/ncm-pbsknownhosts/src/main/pan/components/pbsknownhosts/schema.pan deleted file mode 100755 index 00f453cf..00000000 --- a/ncm-pbsknownhosts/src/main/pan/components/pbsknownhosts/schema.pan +++ /dev/null @@ -1,25 +0,0 @@ -# ${license-info} -# ${developer-info} -# ${author-info} -# ${build-info} -# - -declaration template components/pbsknownhosts/schema; - -include 'quattor/schema'; - -type ${project.artifactId}_component = { - include structure_component - 'configFile' : string = '/opt/edg/etc/edg-pbs-knownhosts.conf' - 'pbsbin' : string = '/usr/bin' - 'nodes' : string = '' - 'keytypes' : string = 'rsa1,rsa,dsa' - 'knownhosts' : string = '/etc/ssh/ssh_known_hosts' - 'knownhostsscript' ? string - 'targets' ? string[] - 'shostsConfigFile' ? string - 'shosts' ? string - 'shostsscript' ? string -}; - -bind '/software/components/${project.artifactId}' = ${project.artifactId}_component; diff --git a/ncm-pbsknownhosts/src/main/perl/pbsknownhosts.pm b/ncm-pbsknownhosts/src/main/perl/pbsknownhosts.pm deleted file mode 100755 index 5d5c777a..00000000 --- a/ncm-pbsknownhosts/src/main/perl/pbsknownhosts.pm +++ /dev/null @@ -1,187 +0,0 @@ -# ${license-info} -# ${developer-info} -# ${author-info} -# ${build-info} -# - -package NCM::Component::pbsknownhosts; - -use strict; -use NCM::Component; -use vars qw(@ISA $EC); -@ISA = qw(NCM::Component); -$EC=LC::Exception::Context->new->will_store_all; -use NCM::Check; -use File::Copy; - -use File::Path; -use File::Basename; - -# Define paths for convenience. -my $base = "/software/components/pbsknownhosts"; - -my $pbsbin_def = "/usr/bin"; - - -########################################################################## -sub Configure($$@) { -########################################################################## - - my ($self, $config) = @_; - - # what files need to be generated? - # by default generate pbs_known_hosts and leave shosts.equiv alone - my @targets; - if ($config->elementExists("$base/targets")) { - my @t = $config->getElement("$base/targets")->getList(); - foreach my $tval ( @t ) { - push @targets, $tval->getValue(); - } - } else { - @targets = ( "pbsknownhosts" ); - } - - foreach ( @targets ) { - my $filename; - if (/knownhosts/) { - $filename = "pbs_known_hosts"; - $self->debug(1,"Generating pbs-knownhosts config file for ssh_known_hosts generation"); - } elsif (/shosts/) { - $filename = "shosts.equiv"; - $self->debug(1,"Generating pbs-shostsequiv config file for shosts.equiv generation"); - }; - if ( !$self->make_sshfile($config,$_) ) { - $self->error("cannot create $filename file"); - return 1; - } - } - - return 1; -} - - -sub make_sshfile($$@) { - - my ($self, $config,$target ) = @_; - - my $contents = "# File genererated by ncm-pbsknownhosts on " . localtime() . - ".\n#\n"; - - my $filenameResource; - my $scriptResource; - my $scriptDefault; - if ( $target =~ /shosts/ ) { - $filenameResource = "shostsConfigFile"; - $scriptResource = "shostsscript"; - $scriptDefault = "/opt/edg/sbin/edg-pbs-shostsequiv"; - $contents = $contents . "SHOSTSEQUIV = /etc/ssh/shosts.equiv\n"; - } else { - $filenameResource = "configFile"; - $scriptResource = "knownhostsscript"; - $scriptDefault = "/opt/edg/sbin/edg-pbs-knownhosts"; - $contents = $contents . "KNOWNHOSTS = /etc/ssh/ssh_known_hosts\n"; - } - - # Get the configuration file name. - my $fname; - if ($config->elementExists("$base/$filenameResource")) { - $fname = $config->getValue("$base/$filenameResource"); - } else { - $self->error("configuration file name not specified"); - return 1; - } - - # Get the script name. - my $script; - if ($config->elementExists("$base/$scriptResource")) { - $script = $config->getValue("$base/$scriptResource"); - } else { - $script = $scriptDefault; - } - - # Get configuration parameters - - if ($config->elementExists("$base/nodes")) { - my $nodes = $config->getValue("$base/nodes"); - $nodes =~ s/\s+/ /g; - $contents = $contents . "NODES = $nodes\n"; - } - - my $pbsbin; - if ($config->elementExists("$base/pbsbin")) { - $pbsbin = $config->getValue("$base/pbsbin"); - } else { - $pbsbin = $pbsbin_def; - } - $contents = $contents . "PBSBIN = $pbsbin\n"; - - if ($config->elementExists("$base/keytypes")) { - my $keytypes = $config->getValue("$base/keytypes"); - $contents = $contents . "KEYTYPES = $keytypes\n"; - } else { - $self->error("Missing keytypes"); - } - - # Now just create the new configuration file. Be careful to save - # a backup of the previous file if necessary. - if ( ! -e $fname ) { - - # Configuration file doesn't exist yet. Create it. - open ( CONF,">$fname" ); - print CONF $contents; - close (CONF); - $self->log("$fname created"); - - } else { - - # Already exists. Make backup and create new file. - my $result = LC::Check::file( $fname, - backup => ".old", - contents => $contents, - ); - $self->log("$fname updated") if $result; - } - - # Do a run of the script to generate the initial known hosts file. - if ( ( ! -f "$fname.old" ) or cdiffer($fname,"$fname.old") ) { - $self->log("$fname modified, running $script"); - if (-x $script) { - system($script); - $self->warn("$script failed: $?") if $?; - } else { - $self->warn("$script is not executable"); - } - } - - return 1; -} - -# do a content-only comparison between two files. This is needed as -# LC::File::differ will trigger on differences in comments (like the -# generation time). Both must exist. -sub cdiffer($$) { - my ($f1,$f2) = @_; - my $c1 = LC::File::file_contents($f1); - my $c2 = LC::File::file_contents($f2); - - if ( $c1 and $c2 ) { - $c1=~s/#[^\n]*\n//sg; - $c2=~s/#[^\n]*\n//sg; - return 0 if ( $c1 eq $c2 ); - } else { - return 1; - } - return 1; -} - - -# Change ownership by name. -sub createAndChownDir { - - my ($user, $dir) = @_; - - mkpath($dir,0,0755); - chown((getpwnam($user))[2,3], glob($dir)) if (-d $dir); -} - -1; # Required for PERL modules diff --git a/ncm-pbsknownhosts/src/main/perl/pbsknownhosts.pod b/ncm-pbsknownhosts/src/main/perl/pbsknownhosts.pod deleted file mode 100755 index c89a20ed..00000000 --- a/ncm-pbsknownhosts/src/main/perl/pbsknownhosts.pod +++ /dev/null @@ -1,72 +0,0 @@ -# ${license-info} -# ${developer-info} -# ${author-info} -# ${build-info} -# - -=head1 NAME - -The I component manages the configuration file -for the edg-pbs-knownhosts script. - -=head1 DESCRIPTION - -The I component manages the configuration file for the -edg-pbs-knownhosts script. - -=head1 RESOURCES - -=head2 configfile (/opt/edg/etc/edg-pbs-knownhosts.conf) - -The location of the configuration file. Normally this should not be -changed. - -=head2 pbsbin (/usr/bin) - -The path to the pbs executables. - -=head2 nodes () - -Space-separated list of additional nodes to add to known hosts -configuration file. The default is the empty list. - -=head2 keytypes (rsa1,rsa,dsa) - -The types of ssh keys to generate. - -=head2 knownhosts (/etc/ssh/ssh_known_hosts) - -The ssh known hosts file to update. - -=head2 knownhostsscript (/opt/edg/sbin/edg-pbs-knownhosts) - -The script to run for generating the known hosts. - -=head2 targets (optional, string[]) - -Specify what configuration files should be generated. The default -is to generate a configuration for edg-pbs-knownhosts only, but -is can be set to also - or alternatively - generate the -configuration for edg-pbs-shostsequiv. - -The value is an array of strings that specify the disired -behaviour: "pbsknownhosts/targets" = list("pbsknownhosts") will -generate the edg-pbs-knownhosts config only; "pbsknownhosts/targets" = -list("shostsequiv") will generate edg-pbs-shostsequiv config only; -and "pbsknownhosts/targets" = list("pbsknownhosts","shostsequiv") will -generate both. - -=head2 shostsConfigFile (optional, /opt/edg/etc/edg-pbs-shostsequiv.conf) - -The location of the shosts-script configuration file. Normally this -should not be changed. - -=head2 shosts (optional, /etc/ssh/shosts.equiv) - -The ssh shosts.equiv file to update - -=head2 shostsscript (optional, /opt/edg/sbin/edg-pbs-shostsequiv) - -The script to run for generating shosts.equiv. - -=cut diff --git a/ncm-pbsknownhosts/src/test/perl/00-load.t b/ncm-pbsknownhosts/src/test/perl/00-load.t deleted file mode 100644 index 25392b25..00000000 --- a/ncm-pbsknownhosts/src/test/perl/00-load.t +++ /dev/null @@ -1,18 +0,0 @@ -# ${license-info} -# ${author-info} -# ${build-info} - -=pod - -=head1 Smoke test - -Basic test that ensures that our module will load correctly. - -=cut - -use strict; -use warnings; -use Test::More tests => 1; -use Test::Quattor; - -use_ok("NCM::Component::pbsknownhosts"); diff --git a/ncm-pbsknownhosts/src/test/perl/pod-syntax.t b/ncm-pbsknownhosts/src/test/perl/pod-syntax.t deleted file mode 100644 index a7864338..00000000 --- a/ncm-pbsknownhosts/src/test/perl/pod-syntax.t +++ /dev/null @@ -1,6 +0,0 @@ - -use Test::More; -use Test::Pod; - -my @dirs = qw(target/lib/perl); -all_pod_files_ok(all_pod_files(@dirs)); diff --git a/ncm-pbsknownhosts/src/test/resources/ccm.cfg b/ncm-pbsknownhosts/src/test/resources/ccm.cfg deleted file mode 100644 index d0aebda3..00000000 --- a/ncm-pbsknownhosts/src/test/resources/ccm.cfg +++ /dev/null @@ -1,6 +0,0 @@ -debug 0 -get_timeout 1 -profile https://www.google.com -cache_root target/test/cache -retrieve_wait 0 -retrieve_retries 1 diff --git a/pom.xml b/pom.xml index 95e511cc..100986f0 100644 --- a/pom.xml +++ b/pom.xml @@ -42,7 +42,6 @@ ncm-mkgridmap ncm-myproxy ncm-pbsclient - ncm-pbsknownhosts ncm-pbsserver ncm-vomsclient ncm-wlconfig