Modify attributes in control. Clean code in setup.py

This commit is contained in:
Kevin Guerineau
2019-06-09 19:42:11 +02:00
parent b1b27c29dd
commit b96a9c52e4
4 changed files with 53 additions and 81 deletions

View File

@@ -1,26 +1,26 @@
package : kg-disable-access-computer-location
version : 0-3
version : 1-4
architecture : all
section : base
priority : optional
name :
maintainer : Administrator
description : Package for kg-disable-computer-location
maintainer : Kevin Guerineau <k@kguerineau.net>
description : Disable access to the computer location
depends :
conflicts :
maturity :
locale :
target_os :
min_os_version :
maturity : PROD
locale : all
target_os : windows
min_os_version : 10
max_os_version :
min_wapt_version :
sources :
min_wapt_version : 1.6
sources : https://gitea.tbnk.ca/kguerineau/wapt-packages/src/branch/master/kg-disable-access-computer-location-wapt
installed_size :
impacted_process :
description_fr :
description_pl :
description_de :
description_es :
description_fr : Désactiver l'accès à la localisation de l'ordinateur
description_pl : Wylaczyc dostep do lokalizacji komputera
description_de : Zugriff auf den Computerstandort deaktivieren
description_es : Desactivar el acceso a la ubicación del equipo
audit_schedule :
editor :
keywords :

View File

@@ -5,31 +5,17 @@ uninstallkey = []
def install():
print('installing %s' % control.asrequirement())
registry_set(HKEY_LOCAL_MACHINE,'SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location','Value','Deny')
registry_set(HKEY_LOCAL_MACHINE,r'SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location','Value','Deny')
def uninstall():
print('uninstalling %s' % control.asrequirement())
registry_set(HKEY_LOCAL_MACHINE,'SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location','Value','Allow')
registry_set(HKEY_LOCAL_MACHINE,r'SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location','Value','Allow')
def session_setup():
print('Session setup for %s' % control.asrequirement())
# put here what to do when package is configured inside a user session
# implicit context variables are WAPT, control, user, params
def update_package():
print('Update package content from upstream binary sources')
# put here what to do to update package content with newer installers.
# launched with command wapt-get update-package-sources <path-to-wapt-directory>
# implicit context variables are WAPT, basedir, control, user, params, run
# if attributes in control are changed, they should be explicitly saved to package file with control.save_control_to_wapt()
def audit():
print('Auditing %s' % control.asrequirement())
if registry_readstring(HKEY_LOCAL_MACHINE,'SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location','Value').lower() == 'deny':
if registry_readstring(HKEY_LOCAL_MACHINE,r'SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location','Value').lower() == 'deny':
return 'OK'
else:
return 'Error'
if __name__ == '__main__':
update_package()
return 'Error'

View File

@@ -1,37 +1,37 @@
package : kg-disable-access-contact
version : 0-2
version : 1-2
architecture : all
section : base
priority : optional
name :
maintainer : Administrator
description : Package for kg-disable-access-contact
depends :
conflicts :
maturity :
locale :
target_os :
min_os_version :
max_os_version :
min_wapt_version :
sources :
installed_size :
impacted_process :
description_fr :
description_pl :
description_de :
description_es :
audit_schedule :
editor :
keywords :
licence :
homepage :
package_uuid : a1964edc-a9ea-4474-a6a1-5521028909af
valid_from :
valid_until :
forced_install_on :
signer : wapt-private
signer_fingerprint: f92cc2c37728a7041fdc444a610944e93e722bc118d6e3c1d27de71fea99afdf
signature : I2/j4STRdomraMXCzpbQpBQ9WGAu/awoVHwx3pnh18Fg7XWqGVHyWj6g0R39QE/xDyHlVcUKW6hwmL0QHFm6UAuxNd8JtsbVpeE4Vc6jR0zOKPQ5WdDpr2e7mOO4STgA46CMw++qNk+mjXt17t0YDCjL6xiEdu7j+n1cMPpXzi/Oh05yZlc641T51YxFlcM+Qt/2FcoAklKkOVg/AOK4hyp6btMFsQEshcEcaTkBIKf+39UHPUmJu3rWU9wewFTQ+qW3AMksWeqwKDfrRK2WMNKFDs7rG+5CP6CdTBxm/Y4hHKwCi2oN2a6s88OMb7j0Wop3jEScRyDYT+415FafAw==
signature_date : 2019-06-01T14:13:20.383000
signed_attributes : package,version,architecture,section,priority,name,maintainer,description,depends,conflicts,maturity,locale,target_os,min_os_version,max_os_version,min_wapt_version,sources,installed_size,impacted_process,description_fr,description_pl,description_de,description_es,audit_schedule,editor,keywords,licence,homepage,package_uuid,valid_from,valid_until,forced_install_on,signer,signer_fingerprint,signature_date,signed_attributes
name :
maintainer : Kévin Guérineau <k@kguerineau.net>
description : Disable access to computer contacts
depends :
conflicts :
maturity : PROD
locale : all
target_os : windows
min_os_version : 10
max_os_version :
min_wapt_version : 1.6
sources : https://gitea.tbnk.ca/kguerineau/wapt-packages/src/branch/master/kg-disable-access-contact-wapt
installed_size :
impacted_process :
description_fr : Désactiver l'accès aux contacts de l'ordinateur
description_pl : Wylaczenie dostepu do kontaktów z komputerem
description_de : Zugriff auf Computerkontakte deaktivieren
description_es : Desactivar el acceso a los contactos del ordenador
audit_schedule :
editor :
keywords :
licence :
homepage :
package_uuid :
valid_from :
valid_until :
forced_install_on :
signer :
signer_fingerprint:
signature :
signature_date :
signed_attributes :

View File

@@ -7,29 +7,15 @@ def install():
print('installing %s' % control.asrequirement())
registry_set(HKEY_LOCAL_MACHINE,'SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\contacts','Value','Deny')
def uninstall():
print('uninstalling %s' % control.asrequirement())
registry_set(HKEY_LOCAL_MACHINE,'SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\contacts','Value','Allow')
def session_setup():
print('Session setup for %s' % control.asrequirement())
# put here what to do when package is configured inside a user session
# implicit context variables are WAPT, control, user, params
def update_package():
print('Update package content from upstream binary sources')
# put here what to do to update package content with newer installers.
# launched with command wapt-get update-package-sources <path-to-wapt-directory>
# implicit context variables are WAPT, basedir, control, user, params, run
# if attributes in control are changed, they should be explicitly saved to package file with control.save_control_to_wapt()
def audit():
print('Auditing %s' % control.asrequirement())
if registry_readstring(HKEY_LOCAL_MACHINE,'SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\contacts','Value').lower() == 'deny':
return 'OK'
else:
return 'Error'
if __name__ == '__main__':
update_package()
return 'Error'