Skip to content

Commit

Permalink
3.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lbr38 committed Dec 5, 2024
1 parent e350754 commit 92af6c3
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 41 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/build-and-test-deb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ jobs:
run: python3 /opt/linupdate/linupdate.py --mod-enable reposerver

- name: "Run test: configure reposerver module"
run: python3 /opt/linupdate/linupdate.py --mod-configure reposerver --url https://packages.bespin.ovh
run: python3 /opt/linupdate/linupdate.py --mod-configure reposerver --url https://packages.repomanager.net

- name: "Run test: register to reposerver"
run: python3 /opt/linupdate/linupdate.py --mod-configure reposerver --api-key ${{ secrets.REPOSITORY_TOKEN }} --register
Expand Down Expand Up @@ -292,7 +292,7 @@ jobs:
run: python3 /opt/linupdate/linupdate.py --mod-enable reposerver

- name: "Run test: configure reposerver module"
run: python3 /opt/linupdate/linupdate.py --mod-configure reposerver --url https://packages.bespin.ovh
run: python3 /opt/linupdate/linupdate.py --mod-configure reposerver --url https://packages.repomanager.net

- name: "Run test: register to reposerver"
run: python3 /opt/linupdate/linupdate.py --mod-configure reposerver --api-key ${{ secrets.REPOSITORY_TOKEN }} --register
Expand Down Expand Up @@ -395,7 +395,7 @@ jobs:
run: python3 /opt/linupdate/linupdate.py --mod-enable reposerver

- name: "Run test: configure reposerver module"
run: python3 /opt/linupdate/linupdate.py --mod-configure reposerver --url https://packages.bespin.ovh
run: python3 /opt/linupdate/linupdate.py --mod-configure reposerver --url https://packages.repomanager.net

- name: "Run test: register to reposerver"
run: python3 /opt/linupdate/linupdate.py --mod-configure reposerver --api-key ${{ secrets.REPOSITORY_TOKEN }} --register
Expand Down Expand Up @@ -495,7 +495,7 @@ jobs:
run: sudo python3 /opt/linupdate/linupdate.py --mod-enable reposerver

- name: "Run test: configure reposerver module"
run: sudo python3 /opt/linupdate/linupdate.py --mod-configure reposerver --url https://packages.bespin.ovh
run: sudo python3 /opt/linupdate/linupdate.py --mod-configure reposerver --url https://packages.repomanager.net

- name: "Run test: register to reposerver"
run: sudo python3 /opt/linupdate/linupdate.py --mod-configure reposerver --api-key ${{ secrets.REPOSITORY_TOKEN }} --register
Expand Down Expand Up @@ -528,8 +528,8 @@ jobs:
run: |
apt-get update -y
apt-get install -y curl gpg
curl -sS https://packages.bespin.ovh/repo/gpgkeys/packages.bespin.ovh.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/packages.bespin.ovh.gpg
echo "deb https://packages.bespin.ovh/repo/linupdate/bullseye/main_prod bullseye main" > /etc/apt/sources.list.d/linupdate.list
curl -sS https://packages.repomanager.net/repo/gpgkeys/packages.repomanager.net.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/packages.repomanager.net.gpg
echo "deb https://packages.repomanager.net/repo/linupdate/bullseye/main_prod bullseye main" > /etc/apt/sources.list.d/linupdate.list
apt-get update -y
apt-get install -y linupdate
Expand All @@ -543,7 +543,7 @@ jobs:
sed -i 's/MAIL_RECIPIENT=.*/MAIL_RECIPIENT="[email protected]"/g' /etc/linupdate/linupdate.conf
sed -i 's/SERVICE_RESTART=.*/SERVICE_RESTART="service1,service2"/g' /etc/linupdate/linupdate.conf
linupdate --mod-enable reposerver
linupdate --mod-configure reposerver --url https://packages.bespin.ovh --fail-level 3
linupdate --mod-configure reposerver --url https://packages.repomanager.net --fail-level 3
linupdate --mod-configure reposerver --get-packages-conf-from-reposerver no
linupdate --mod-configure reposerver --get-repos-from-reposerver no
linupdate --mod-configure reposerver --api-key ${{ secrets.REPOSITORY_TOKEN }} --register
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-and-test-rpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ jobs:
run: python3 /opt/linupdate/linupdate.py --mod-enable reposerver

- name: "Run test: configure reposerver module"
run: python3 /opt/linupdate/linupdate.py --mod-configure reposerver --url https://packages.bespin.ovh
run: python3 /opt/linupdate/linupdate.py --mod-configure reposerver --url https://packages.repomanager.net

- name: "Run test: register to reposerver"
run: python3 /opt/linupdate/linupdate.py --mod-configure reposerver --api-key ${{ secrets.REPOSITORY_TOKEN }} --register
Expand Down Expand Up @@ -330,7 +330,7 @@ jobs:
run: python3 /opt/linupdate/linupdate.py --mod-enable reposerver

- name: "Run test: configure reposerver module"
run: python3 /opt/linupdate/linupdate.py --mod-configure reposerver --url https://packages.bespin.ovh
run: python3 /opt/linupdate/linupdate.py --mod-configure reposerver --url https://packages.repomanager.net

- name: "Run test: register to reposerver"
run: python3 /opt/linupdate/linupdate.py --mod-configure reposerver --api-key ${{ secrets.REPOSITORY_TOKEN }} --register
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ jobs:
release_name: ${{ env.VERSION }}
body: |
**Changes**:
- Requests from reposerver now support more options like dry-run, keep old config files, etc...
- Various typo fixes
- Reposerver module: sending connection type to meet the new requirements of the server (Repomanager v4.14.1)
- Various fixes and improvements
draft: false
prerelease: false

Expand All @@ -202,19 +202,19 @@ jobs:
# Upload package to repository
- name: Upload packages to repositories
run: |
curl --fail-with-body -L --post301 -s -q -X POST -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -F "files=@$HOME/assets/linupdate_${{ env.VERSION }}_all.deb" https://packages.bespin.ovh/api/v2/snapshot/67/upload
curl --fail-with-body -L --post301 -s -q -X POST -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -F "files=@$HOME/assets/linupdate_${{ env.VERSION }}_all.deb" https://packages.bespin.ovh/api/v2/snapshot/66/upload
curl --fail-with-body -L --post301 -s -q -X POST -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -F "files=@$HOME/assets/linupdate_${{ env.VERSION }}_all.deb" https://packages.bespin.ovh/api/v2/snapshot/68/upload
curl --fail-with-body -L --post301 -s -q -X POST -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -F "files=@$HOME/assets/linupdate_${{ env.VERSION }}_all.deb" https://packages.bespin.ovh/api/v2/snapshot/73/upload
curl --fail-with-body -L --post301 -s -q -X POST -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -F "files=@$HOME/assets/linupdate-${{ env.VERSION }}.noarch.rpm" https://packages.bespin.ovh/api/v2/snapshot/70/upload
curl --fail-with-body -L --post301 -s -q -X POST -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -F "files=@$HOME/assets/linupdate-${{ env.VERSION }}.noarch.rpm" https://packages.bespin.ovh/api/v2/snapshot/71/upload
curl --fail-with-body -L --post301 -s -q -X POST -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -F "files=@$HOME/assets/linupdate_${{ env.VERSION }}_all.deb" https://packages.repomanager.net/api/v2/snapshot/67/upload
curl --fail-with-body -L --post301 -s -q -X POST -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -F "files=@$HOME/assets/linupdate_${{ env.VERSION }}_all.deb" https://packages.repomanager.net/api/v2/snapshot/66/upload
curl --fail-with-body -L --post301 -s -q -X POST -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -F "files=@$HOME/assets/linupdate_${{ env.VERSION }}_all.deb" https://packages.repomanager.net/api/v2/snapshot/68/upload
curl --fail-with-body -L --post301 -s -q -X POST -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -F "files=@$HOME/assets/linupdate_${{ env.VERSION }}_all.deb" https://packages.repomanager.net/api/v2/snapshot/73/upload
curl --fail-with-body -L --post301 -s -q -X POST -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -F "files=@$HOME/assets/linupdate-${{ env.VERSION }}.noarch.rpm" https://packages.repomanager.net/api/v2/snapshot/70/upload
curl --fail-with-body -L --post301 -s -q -X POST -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -F "files=@$HOME/assets/linupdate-${{ env.VERSION }}.noarch.rpm" https://packages.repomanager.net/api/v2/snapshot/71/upload
# Rebuild repositories metadata
- name: Rebuild repositories
run: |
curl --fail-with-body -X PUT -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -d '{"gpgSign":"true"}' https://packages.bespin.ovh/api/v2/snapshot/67/rebuild
curl --fail-with-body -X PUT -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -d '{"gpgSign":"true"}' https://packages.bespin.ovh/api/v2/snapshot/66/rebuild
curl --fail-with-body -X PUT -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -d '{"gpgSign":"true"}' https://packages.bespin.ovh/api/v2/snapshot/68/rebuild
curl --fail-with-body -X PUT -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -d '{"gpgSign":"true"}' https://packages.bespin.ovh/api/v2/snapshot/73/rebuild
curl --fail-with-body -X PUT -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -d '{"gpgSign":"true"}' https://packages.bespin.ovh/api/v2/snapshot/70/rebuild
curl --fail-with-body -X PUT -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -d '{"gpgSign":"true"}' https://packages.bespin.ovh/api/v2/snapshot/71/rebuild
curl --fail-with-body -X PUT -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -d '{"gpgSign":"true"}' https://packages.repomanager.net/api/v2/snapshot/67/rebuild
curl --fail-with-body -X PUT -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -d '{"gpgSign":"true"}' https://packages.repomanager.net/api/v2/snapshot/66/rebuild
curl --fail-with-body -X PUT -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -d '{"gpgSign":"true"}' https://packages.repomanager.net/api/v2/snapshot/68/rebuild
curl --fail-with-body -X PUT -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -d '{"gpgSign":"true"}' https://packages.repomanager.net/api/v2/snapshot/73/rebuild
curl --fail-with-body -X PUT -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -d '{"gpgSign":"true"}' https://packages.repomanager.net/api/v2/snapshot/70/rebuild
curl --fail-with-body -X PUT -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -d '{"gpgSign":"true"}' https://packages.repomanager.net/api/v2/snapshot/71/rebuild
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ It should help you **installing** and starting using linupdate.
Available options:

Name Description
-- ------------------------------------------- -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- ------------------------------------------- --------------------------------------------------------------------------------------------------
--help, -h Show help
--show-config, -sc Show raw configuration
--version, -v Show version
Expand All @@ -51,18 +51,20 @@ It should help you **installing** and starting using linupdate.
--mail-enable [true|false] Enable or disable mail reports
--get-mail-recipient Get current mail recipient(s)
--set-mail-recipient [EMAIL] Set mail recipient(s) (separated by commas)
--get-mail-stmp-host Get current mail SMTP host
--set-mail-stmp-host [HOST] Set mail SMTP host
--get-mail-stmp-port Get current mail SMTP port
--set-mail-stmp-port [PORT] Set mail SMTP port
--get-mail-smtp-host Get current mail SMTP host
--set-mail-smtp-host [HOST] Set mail SMTP host
--get-mail-smtp-port Get current mail SMTP port
--set-mail-smtp-port [PORT] Set mail SMTP port

Update options

--update, -u [PACKAGE] Update only the specified packages (separated by commas)
--dist-upgrade, -du Enable distribution upgrade when updating packages (Debian based OS only)
--dry-run Simulate the update process (do not update packages)
--keep-oldconf Keep old configuration files when updating packages (Debian based OS only)
--assume-yes, -y Answer yes to all questions
--check-updates, -cu Only check for updates and exit
--ignore-exclude, -ie Ignore all package exclusions
--ignore-exclusions, -ie Ignore all package exclusions
--exit-on-package-update-error [true|false] Immediately exit if an error occurs during package update and do not update the remaining packages

Packages exclusion and services restart
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/App/App.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,5 +151,5 @@ def print_summary(self, fromAgent: bool = False):
print(' Profile: ' + Fore.YELLOW + myAppConfig.get_profile() + Style.RESET_ALL)
print(' Environment: ' + Fore.YELLOW + myAppConfig.get_environment() + Style.RESET_ALL)
print(' Execution date: ' + Fore.YELLOW + datetime.now().strftime('%d-%m-%Y %H:%M:%S') + Style.RESET_ALL)
print(' Execution method: ' + Fore.YELLOW + exec_method + Style.RESET_ALL)
print(' Executed by user: ' + Fore.YELLOW + getpass.getuser() + Style.RESET_ALL + '\n')
print(' Execution method: ' + Fore.YELLOW + exec_method + Style.RESET_ALL)
4 changes: 2 additions & 2 deletions src/controllers/Module/Module.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def load(self):
def pre(self):
for module in self.loadedModules:
try:
print('\n Executing ' + Fore.YELLOW + module + Style.RESET_ALL + ' pre-update actions')
print('\n Executing ' + Fore.YELLOW + module + Style.RESET_ALL + ' pre-update actions:')
# Convert module name to uppercase first letter
moduleName = module.capitalize()

Expand All @@ -214,7 +214,7 @@ def pre(self):
def post(self, updateSummary):
for module in self.loadedModules:
try:
print('\n Executing ' + Fore.YELLOW + module + Style.RESET_ALL + ' post-update actions')
print('\n Executing ' + Fore.YELLOW + module + Style.RESET_ALL + ' post-update actions:')
# Convert module name to uppercase first letter
moduleName = module.capitalize()

Expand Down
9 changes: 8 additions & 1 deletion src/controllers/Module/Reposerver/Agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,14 @@ def websocket_on_close(self, ws, close_status_code, close_msg):
#
#-----------------------------------------------------------------------------------------------
def websocket_on_open(self, ws):
print('[reposerver-agent] Opening connection with reposerver')
print('[reposerver-agent] Opened connection with reposerver')

# Send connection type to the reposerver
self.websocket.send(
json.dumps({
'connection-type': 'host'
})
)


#-----------------------------------------------------------------------------------------------
Expand Down
7 changes: 7 additions & 0 deletions src/controllers/Module/Reposerver/Reposerver.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Import classes
from src.controllers.Module.Reposerver.Config import Config as Config
from src.controllers.Module.Reposerver.Args import Args
from src.controllers.Module.Reposerver.Status import Status

class Reposerver:
def __init__(self):
Expand Down Expand Up @@ -48,6 +49,8 @@ def pre(self):
def post(self, updateSummary):
# Note: no need of try / except block here, as it is already handled in the Module pre() function

statusController = Status()

# Quit if there was no packages updates
if updateSummary['update']['status'] == 'nothing-to-do':
print(' ▪ Nothing to do as no packages have been updated')
Expand All @@ -56,6 +59,10 @@ def post(self, updateSummary):
# Generaly "*-release" packages on Redhat/CentOS are resetting .repo files. So it is better to retrieve them again from the reposerver
self.configController.get_profile_repos()

# Send package status to reposerver
# TODO: to test
# statusController.send_packages_info()


#-----------------------------------------------------------------------------------------------
#
Expand Down
14 changes: 7 additions & 7 deletions src/controllers/Module/Reposerver/Status.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def send_general_info(self):
'reboot_required': str(self.systemController.reboot_required()).lower() # Convert True/False to 'true'/'false'
}

print('\n Sending general informations to ' + Fore.YELLOW + url + Style.RESET_ALL + ':')
print('\n Sending general informations to ' + Fore.YELLOW + url + Style.RESET_ALL + ':')

except Exception as e:
raise Exception('could not build general status data: ' + str(e))
Expand Down Expand Up @@ -91,7 +91,7 @@ def sendAvailablePackagesStatus(self):

available_packages = 'none'

print('\n Building available packages list...')
print('\n Building available packages list...')

try:
# Retrieve available packages
Expand Down Expand Up @@ -131,7 +131,7 @@ def sendAvailablePackagesStatus(self):
raise Exception('error while retrieving available packages: ' + str(e))

# Send available packages to Reposerver
print(' Sending available packages to ' + Fore.YELLOW + url + Style.RESET_ALL + ':')
print(' Sending available packages to ' + Fore.YELLOW + url + Style.RESET_ALL + ':')

self.httpRequestController.quiet = False
self.httpRequestController.put(url + '/api/v2/host/packages/available', id, token, data, 5, 10)
Expand All @@ -150,7 +150,7 @@ def sendInstalledPackagesStatus(self):

installed_packages = ''

print('\n Building installed packages list...')
print('\n Building installed packages list...')

try:
# Retrieve installed packages
Expand Down Expand Up @@ -181,7 +181,7 @@ def sendInstalledPackagesStatus(self):
raise Exception('error while retrieving installed packages: ' + str(e))

# Send installed packages to Reposerver
print(' Sending installed packages to ' + Fore.YELLOW + url + Style.RESET_ALL + ':')
print(' Sending installed packages to ' + Fore.YELLOW + url + Style.RESET_ALL + ':')

self.httpRequestController.quiet = False
self.httpRequestController.put(url + '/api/v2/host/packages/installed', id, token, data, 5, 10)
Expand All @@ -201,7 +201,7 @@ def send_packages_history(self, entries_limit: int = 999999):
# History parsing will start from the oldest to the newest
history_order = 'oldest'

print('\n Building packages history...')
print('\n Building packages history...')

# If limit is set (not the default 999999), history parsing will start from the newest to the oldest
if entries_limit != 999999:
Expand Down Expand Up @@ -232,7 +232,7 @@ def send_packages_history(self, entries_limit: int = 999999):
except Exception as e:
raise Exception('could not parse packages history: ' + str(e))

print(' Sending packages events to ' + Fore.YELLOW + url + Style.RESET_ALL + ':')
print(' Sending packages events to ' + Fore.YELLOW + url + Style.RESET_ALL + ':')

self.httpRequestController.quiet = False
self.httpRequestController.put(url + '/api/v2/host/packages/event', id, token, events, 5, 10)
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.6.0
3.7.0

0 comments on commit 92af6c3

Please sign in to comment.