Add Check Point Gaia (FW1) management and firewall appliances to explorers #339
4 changed files with 4 additions and 62 deletions
|
@ -1,55 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
#
|
|
||||||
# Remove the given apt repository.
|
|
||||||
#
|
|
||||||
# Exit with:
|
|
||||||
# 0: if it worked
|
|
||||||
# 1: if not
|
|
||||||
# 2: on other error
|
|
||||||
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
from aptsources import distro, sourceslist
|
|
||||||
from softwareproperties import ppa
|
|
||||||
from softwareproperties.SoftwareProperties import SoftwareProperties
|
|
||||||
|
|
||||||
|
|
||||||
def remove_if_empty(file_name):
|
|
||||||
with open(file_name, 'r') as f:
|
|
||||||
if f.read().strip():
|
|
||||||
return
|
|
||||||
os.unlink(file_name)
|
|
||||||
|
|
||||||
def remove_repository(repository):
|
|
||||||
#print 'repository:', repository
|
|
||||||
codename = distro.get_distro().codename
|
|
||||||
#print 'codename:', codename
|
|
||||||
(line, file) = ppa.expand_ppa_line(repository.strip(), codename)
|
|
||||||
#print 'line:', line
|
|
||||||
#print 'file:', file
|
|
||||||
deb_source_entry = sourceslist.SourceEntry(line, file)
|
|
||||||
src_source_entry = sourceslist.SourceEntry('deb-src{}'.format(line[3:]), file)
|
|
||||||
|
|
||||||
try:
|
|
||||||
sp = SoftwareProperties()
|
|
||||||
sp.remove_source(deb_source_entry)
|
|
||||||
try:
|
|
||||||
# If there's a deb-src entry, remove that too
|
|
||||||
sp.remove_source(src_source_entry)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
remove_if_empty(file)
|
|
||||||
return True
|
|
||||||
except ValueError:
|
|
||||||
print >> sys.stderr, "Error: '%s' doesn't exists in a sourcelist file" % line
|
|
||||||
return False
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
if (len(sys.argv) != 2):
|
|
||||||
print >> sys.stderr, 'Error: need a repository as argument'
|
|
||||||
sys.exit(2)
|
|
||||||
repository = sys.argv[1]
|
|
||||||
if remove_repository(repository):
|
|
||||||
sys.exit(0)
|
|
||||||
else:
|
|
||||||
sys.exit(1)
|
|
|
@ -29,9 +29,9 @@ fi
|
||||||
|
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
present)
|
present)
|
||||||
echo "add-apt-repository '$name'"
|
echo "add-apt-repository -y '$name'"
|
||||||
;;
|
;;
|
||||||
absent)
|
absent)
|
||||||
echo "remove-apt-repository '$name'"
|
echo "add-apt-repository -r -y '$name'"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -20,9 +20,4 @@
|
||||||
|
|
||||||
__package software-properties-common
|
__package software-properties-common
|
||||||
|
|
||||||
require="__package/software-properties-common" \
|
|
||||||
__file /usr/local/bin/remove-apt-repository \
|
|
||||||
--source "$__type/files/remove-apt-repository" \
|
|
||||||
--mode 0755
|
|
||||||
|
|
||||||
require="$__object_name" __apt_update_index
|
require="$__object_name" __apt_update_index
|
||||||
|
|
|
@ -15,6 +15,8 @@ next:
|
||||||
* Type __ssh_authorized_key: Also remove tmpfile if removing line (Mark Verboom)
|
* Type __ssh_authorized_key: Also remove tmpfile if removing line (Mark Verboom)
|
||||||
* Type __apt_pin: Add default priority, add comment in generated files (Daniel Fancsali)
|
* Type __apt_pin: Add default priority, add comment in generated files (Daniel Fancsali)
|
||||||
* Type __file: make file uploading and attribute changes more atomic (Steven Armstrong)
|
* Type __file: make file uploading and attribute changes more atomic (Steven Armstrong)
|
||||||
|
* Type __dot_file: Add support for using --file parameter (Stephan Leemburg)
|
||||||
|
* Type __apt_ppa: Replace custom "remove-apt-repository" with add-apt-repository -r (Romain Dartigues)
|
||||||
|
|
||||||
6.9.8: 2021-08-24
|
6.9.8: 2021-08-24
|
||||||
* Type __rsync: Rewrite (Ander Punnar)
|
* Type __rsync: Rewrite (Ander Punnar)
|
||||||
|
|
Loading…
Reference in a new issue