#42 Add "latest" download targets for atomic artifacts and provide filenames for users scripting this
Merged 2 years ago by puiterwijk. Opened 2 years ago by maxamillion.
maxamillion/fedora-websites add-atomic-latest-target  into  master

file modified
+16

@@ -193,6 +193,22 @@ 

                  for key2, value in entry.items():

                      getattr(globalvar, key1)[key2] = value

  

+             # Write htaccess rewrite and informational files for 'latest'

+             with open(os.path.join(options.output, ".htaccess"), 'w') as htaccess_f:

+                 for artifact in collected_atomic_vars['release']['redir_map']:

+                     htaccess_f.write('Redirect 302 "/{}_latest" "{}"\n'.format(

+                         artifact,

+                         collected_atomic_vars['release']['redir_map'][artifact]['redirect']

+                         )

+                     )

+             # Write a file that returns the artifact name that corresponds to

+             # the current 'latest' (for scripting purposes).

+             for artifact in collected_atomic_vars['release']['redir_map']:

+                 with open(os.path.join(options.output, "{}_latest_filename".format(artifact)), 'w') as artifact_f:

+                     artifact_f.write(

+                         collected_atomic_vars['release']['redir_map'][artifact]['filename']

+                     )

+ 

          # This is *not* cached

          if update_atomic_age is not None:

              # Go get two-week-atomic release info from datagrepper

@@ -120,6 +120,10 @@ 

  def collect(release):

      results = collections.defaultdict(dict)

  

+     # This is the information needed to provide "latest" download targets that

+     # redirect to the actual mirrormanager url via htpasswd file

+     results['release']['redir_map'] = collections.defaultdict(dict)

+ 

      for idx, composedate_prefix, iso_size_prefix in make_templates(release):

  

          log.info("Looking for latest atomic release for %s" % idx)

@@ -171,6 +175,12 @@ 

              url_key = mapping[key] + "_url"

              results['release'][url_key] = download_url

  

+             # Provide the redirect rule mapping

+             img_filename = download_url.split('/')[-1]

+             results['release']['redir_map'][key] = {}

+             results['release']['redir_map'][key]['redirect'] = download_url

+             results['release']['redir_map'][key]['filename'] = img_filename

+ 

              # Figure out which of our vars we're going to set, and set it

              iso_size_key = iso_size_prefix + mapping[key]

              results['iso_size'][iso_size_key] = str(length)

file modified
+23 -23

@@ -2,13 +2,13 @@ 

  # This is the main Apache HTTP server configuration file.  It contains the

  # configuration directives that give the server its instructions.

  # See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.

- # In particular, see 

+ # In particular, see

  # <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>

  # for a discussion of each configuration directive.

  #

  # Do NOT simply read the instructions in here without understanding

  # what they do.  They're here only as hints or reminders.  If you are unsure

- # consult the online docs. You have been warned.  

+ # consult the online docs. You have been warned.

  #

  # Configuration and logfile names: If the filenames you specify for many

  # of the server's control files begin with "/" (or "drive:/" for Win32), the

@@ -37,7 +37,7 @@ 

  # ports, instead of the default. See also the <VirtualHost>

  # directive.

  #

- # Change this to Listen on specific IP addresses as shown below to 

+ # Change this to Listen on specific IP addresses as shown below to

  # prevent Apache from glomming onto all bound IP addresses.

  #

  #Listen 12.34.56.78:80

@@ -108,7 +108,7 @@ 

  

  #

  # If you wish httpd to run as a different user or group, you must run

- # httpd as root initially and it will switch.  

+ # httpd as root initially and it will switch.

  #

  # User/Group: The name (or #number) of the user/group to run httpd as.

  # It is usually good practice to create a dedicated user and group for

@@ -149,7 +149,7 @@ 

  

  #

  # Deny access to the entirety of your server's filesystem. You must

- # explicitly permit access to web content directories in other 

+ # explicitly permit access to web content directories in other

  # <Directory> blocks below.

  #

  <Directory />

@@ -204,7 +204,7 @@ 

      # It can be "All", "None", or any combination of the keywords:

      #   Options FileInfo AuthConfig Limit

      #

-     AllowOverride None

+     AllowOverride All

  

      #

      # Controls who can get stuff from this server.

@@ -222,8 +222,8 @@ 

  </IfModule>

  

  #

- # The following lines prevent .htaccess and .htpasswd files from being 

- # viewed by Web clients. 

+ # The following lines prevent .htaccess and .htpasswd files from being

+ # viewed by Web clients.

  #

  <Files ".ht*">

      Require all denied

@@ -277,8 +277,8 @@ 

  

  <IfModule alias_module>

      #

-     # Redirect: Allows you to tell clients about documents that used to 

-     # exist in your server's namespace, but do not anymore. The client 

+     # Redirect: Allows you to tell clients about documents that used to

+     # exist in your server's namespace, but do not anymore. The client

      # will make a new request for the document at its new location.

      # Example:

      # Redirect permanent /foo http://www.example.com/bar

@@ -295,7 +295,7 @@ 

      # the filesystem path.

  

      #

-     # ScriptAlias: This controls which directories contain server scripts. 

+     # ScriptAlias: This controls which directories contain server scripts.

      # ScriptAliases are essentially the same as Aliases, except that

      # documents in the target directory are treated as applications and

      # run by the server when requested rather than as documents sent to the

@@ -366,7 +366,7 @@ 

  

  #

  # Specify a default charset for all content served; this enables

- # interpretation of all content as UTF-8 by default.  To use the 

+ # interpretation of all content as UTF-8 by default.  To use the

  # default browser choice (ISO-8859-1), or to allow the META tags

  # in HTML content to override this choice, comment out this

  # directive:

@@ -394,10 +394,10 @@ 

  #

  

  #

- # EnableMMAP and EnableSendfile: On systems that support it, 

+ # EnableMMAP and EnableSendfile: On systems that support it,

  # memory-mapping or the sendfile syscall may be used to deliver

  # files.  This usually improves server performance, but must

- # be turned off when serving from networked-mounted 

+ # be turned off when serving from networked-mounted

  # filesystems or if support for these functions is otherwise

  # broken on your system.

  # Defaults if commented: EnableMMAP On, EnableSendfile Off

@@ -435,21 +435,21 @@ 

  StartServers         2

  MaxClients         150

  MinSpareThreads     25

- MaxSpareThreads     75 

+ MaxSpareThreads     75

  ThreadsPerChild     25

  MaxRequestsPerChild  0

  </IfModule>

  

- # DefaultLanguage and AddLanguage allows you to specify the language of 

- # a document. You can then use content negotiation to give a browser a 

+ # DefaultLanguage and AddLanguage allows you to specify the language of

+ # a document. You can then use content negotiation to give a browser a

  # file in a language the user can understand.

  #

  # Specify a default language. This means that all data

- # going out without a specific language tag (see below) will 

+ # going out without a specific language tag (see below) will

  # be marked with this one. You probably do NOT want to set

  # this unless you are sure it is correct for all cases.

  #

- # * It is generally better to not mark a page as 

+ # * It is generally better to not mark a page as

  # * being a certain language than marking it with the wrong

  # * language!

  #

@@ -460,8 +460,8 @@ 

  # language code is pl) may wish to use "AddLanguage pl .po" to

  # avoid the ambiguity with the common suffix for perl scripts.

  #

- # Note 2: The example entries below illustrate that in some cases 

- # the two character 'Language' abbreviation is not identical to 

+ # Note 2: The example entries below illustrate that in some cases

+ # the two character 'Language' abbreviation is not identical to

  # the two character 'Country' code for its country,

  # E.g. 'Danmark/dk' versus 'Danish/da'.

  #

@@ -485,7 +485,7 @@ 

  # Just list the languages in decreasing order of preference. We have

  # more or less alphabetized them here. You probably want to change this.

  #

- #LanguagePriority en 

+ #LanguagePriority en

  

  #

  # ForceLanguagePriority allows you to serve a result page rather than

@@ -496,7 +496,7 @@ 

  

  #

  # Specify a default charset for all content served; this enables

- # interpretation of all content as UTF-8 by default.  To use the 

+ # interpretation of all content as UTF-8 by default.  To use the

  # default browser choice (ISO-8859-1), or to allow the META tags

  # in HTML content to override this choice, comment out this

  # directive:

We would need to also request from the Fedora Infrastructure team to 'AllowOverride' in httpd.conf that runs this.

This is to satisfy a long standing request from the Fedora Cloud WG that would allow for a single URL that will always result in the latest Atomic image since we are pushing them out so often, users don't want to always have to go to the website and get the new URL.

1 new commit added

  • remove incorrectly left over debug output
2 years ago

Pull-Request has been merged by puiterwijk

2 years ago