forked from AlmaLinux/leapp-repository
    
        
        - 
                Notifications
    You must be signed in to change notification settings 
- Fork 6
Switch CLN channel locally until the last stage of the upgrade #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
  
     Merged
                    Changes from 8 commits
      Commits
    
    
            Show all changes
          
          
            9 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      2af314e
              
                switch cln channel only inside overlayfs for preupgrade check
              
              
                Monstrofil 2c5c019
              
                add requirement for new rhn-client-tools
              
              
                Monstrofil 21a5ba7
              
                fix channel override
              
              
                Monstrofil 1ffc487
              
                split checking cl license and copying files to container
              
              
                Monstrofil 23db389
              
                remove inhibitor for rhn-client-tools version
              
              
                Monstrofil 93075b8
              
                split actor that switches channel and pins mirror
              
              
                Monstrofil 36b6bda
              
                when unpinning mirror, do not modify host config
              
              
                Monstrofil 92f56ac
              
                move switch_cln_channel to first boot stage
              
              
                Monstrofil 1f86500
              
                fix incorrect message in switch_cln_channel actor
              
              
                Monstrofil File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
        
          
          
            61 changes: 0 additions & 61 deletions
          
          61 
        
  repos/system_upgrade/cloudlinux/actors/checkrhnclienttools/actor.py
  
  
      
      
   
        
      
      
    This file was deleted.
      
      Oops, something went wrong.
      
    
  
        
          
          
            46 changes: 0 additions & 46 deletions
          
          46 
        
  repos/system_upgrade/cloudlinux/actors/checkrhnclienttools/libraries/version.py
  
  
      
      
   
        
      
      
    This file was deleted.
      
      Oops, something went wrong.
      
    
  
        
          
          
            44 changes: 44 additions & 0 deletions
          
          44 
        
  repos/system_upgrade/cloudlinux/actors/copycllicense/actor.py
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import os | ||
| from leapp.actors import Actor | ||
| from leapp.reporting import Report | ||
| from leapp.tags import ChecksPhaseTag, IPUWorkflowTag | ||
| from leapp.libraries.common.cllaunch import run_on_cloudlinux | ||
| from leapp.libraries.stdlib import api | ||
| from leapp.models import ( | ||
| TargetUserSpacePreupgradeTasks, | ||
| CopyFile | ||
| ) | ||
|  | ||
|  | ||
| RHN_CONFIG_DIR = '/etc/sysconfig/rhn' | ||
| REQUIRED_PKGS = ['dnf-plugin-spacewalk', 'rhn-client-tools'] | ||
|  | ||
|  | ||
| class CopyClLicense(Actor): | ||
| """ | ||
| Produce task to copy CloudLinux license files to target system. | ||
| """ | ||
|  | ||
| name = 'copy_rhn_client_tools_config' | ||
| consumes = () | ||
| produces = (Report, TargetUserSpacePreupgradeTasks) | ||
| tags = (ChecksPhaseTag, IPUWorkflowTag) | ||
|  | ||
| @run_on_cloudlinux | ||
| def process(self): | ||
| """ | ||
| Produce artifacts to copy RHN configuration files | ||
| and install packages to the target userspace, | ||
| including up2date and systemid. | ||
| """ | ||
| files_to_copy = [] | ||
| for dirpath, _, filenames in os.walk(RHN_CONFIG_DIR): | ||
| for filename in filenames: | ||
| src_path = os.path.join(dirpath, filename) | ||
| if os.path.isfile(src_path): | ||
| files_to_copy.append(CopyFile(src=src_path)) | ||
|  | ||
| api.produce(TargetUserSpacePreupgradeTasks( | ||
| install_rpms=REQUIRED_PKGS, | ||
| copy_files=files_to_copy | ||
| )) | 
        
          
          
            59 changes: 59 additions & 0 deletions
          
          59 
        
  repos/system_upgrade/cloudlinux/actors/pinclnmirror/actor.py
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| import json | ||
| import os | ||
|  | ||
| from leapp.actors import Actor | ||
| from leapp.libraries.stdlib import api | ||
| from leapp.libraries.common.cllaunch import run_on_cloudlinux | ||
| from leapp.libraries.common.cln_switch import get_target_userspace_path | ||
| from leapp.tags import DownloadPhaseTag, IPUWorkflowTag | ||
| from leapp.libraries.common.config.version import get_target_major_version | ||
|  | ||
|  | ||
| class PinClnMirror(Actor): | ||
| """ | ||
| Save CLN mirror that was used last time. | ||
| """ | ||
|  | ||
| name = 'pin_cln_mirror' | ||
| consumes = () | ||
| produces = () | ||
| tags = (IPUWorkflowTag, DownloadPhaseTag.Before) | ||
|  | ||
| CLN_REPO_ID = "cloudlinux-x86_64-server-%s" | ||
| DEFAULT_CLN_MIRROR = "https://xmlrpc.cln.cloudlinux.com/XMLRPC/" | ||
|  | ||
| @run_on_cloudlinux | ||
| def process(self): | ||
| """Pin CLN mirror""" | ||
| target_userspace = get_target_userspace_path() | ||
| api.current_logger().info("Pin CLN mirror: target userspace=%s", target_userspace) | ||
|  | ||
| # load last mirror URL from dnf spacewalk plugin cache | ||
| spacewalk_settings = {} | ||
|  | ||
| # find the mirror used in the last transaction | ||
| # (expecting to find the one used in dnf_package_download actor) | ||
| spacewalk_json_path = os.path.join(target_userspace, 'var/lib/dnf/_spacewalk.json') | ||
| try: | ||
| with open(spacewalk_json_path) as file: | ||
| spacewalk_settings = json.load(file) | ||
| except (OSError, IOError, ValueError): | ||
| api.current_logger().error( | ||
| "No spacewalk settings found in %s - can't identify the last used CLN mirror", | ||
| spacewalk_json_path, | ||
| ) | ||
|  | ||
| mirror_url = spacewalk_settings.get( | ||
| self.CLN_REPO_ID % get_target_major_version(), {} | ||
| ).get("url", [self.DEFAULT_CLN_MIRROR])[0] | ||
|  | ||
| # pin mirror | ||
| mirrorlist_path = os.path.join(target_userspace, 'etc/mirrorlist') | ||
| with open(mirrorlist_path, 'w') as file: | ||
| file.write(mirror_url + '\n') | ||
| api.current_logger().info("Pin CLN mirror %s in %s", mirror_url, mirrorlist_path) | ||
|  | ||
| up2date_path = os.path.join(target_userspace, 'etc/sysconfig/rhn/up2date') | ||
| with open(up2date_path, 'a+') as file: | ||
| file.write('\nmirrorURL[comment]=Set mirror URL to /etc/mirrorlist\nmirrorURL=file:///etc/mirrorlist\n') | ||
| api.current_logger().info("Updated up2date_path %s", up2date_path) | 
        
          
          
            24 changes: 15 additions & 9 deletions
          
          24 
        
  ...nux/actors/switchclnchannelreset/actor.py → ...oudlinux/actors/switchclnchannel/actor.py
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              
      
      Oops, something went wrong.
        
    
  
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.