Drop commented out / dead code

This commit is contained in:
Ryan Harper 2018-05-21 19:36:57 -05:00
parent a30c3a63e4
commit 3c9b2e28c7
10 changed files with 1 additions and 371 deletions

View File

@ -18,5 +18,3 @@
from .identity import IdentityView # NOQA
from .login import LoginView # NOQA
from .welcome import WelcomeView # NOQA
#from .network import NetworkView # NOQA
#from .network_configure_interface import NetworkConfigureInterfaceView # NOQA

View File

@ -50,8 +50,6 @@ class FilesystemController(BaseController):
self.answers.setdefault('guided', False)
self.answers.setdefault('guided-index', 0)
self.answers.setdefault('manual', False)
# self.iscsi_model = IscsiDiskModel()
# self.ceph_model = CephDiskModel()
self.model.probe() # probe before we complete
def default(self):
@ -206,22 +204,9 @@ class FilesystemController(BaseController):
self.partition_disk(disk)
def connect_iscsi_disk(self, *args, **kwargs):
# title = ("Disk and filesystem setup")
# excerpt = ("Connect to iSCSI cluster")
# self.ui.set_header(title, excerpt)
# self.ui.set_footer("")
# self.ui.set_body(IscsiDiskView(self.iscsi_model,
# self.signal))
self.ui.set_body(DummyView(self.signal))
def connect_ceph_disk(self, *args, **kwargs):
# title = ("Disk and filesystem setup")
# footer = ("Select available disks to format and mount")
# excerpt = ("Connect to Ceph storage cluster")
# self.ui.set_header(title, excerpt)
# self.ui.set_footer(footer)
# self.ui.set_body(CephDiskView(self.ceph_model,
# self.signal))
self.ui.set_body(DummyView(self.signal))
def create_volume_group(self, *args, **kwargs):

View File

@ -115,7 +115,6 @@ class InstallProgressController(BaseController):
for identifier in identifiers:
args.append("SYSLOG_IDENTIFIER={}".format(identifier))
reader.add_match(*args)
#reader.seek_tail()
def watch():
if reader.process() != journal.APPEND:
return

View File

@ -263,8 +263,6 @@ class FilesystemModel(object):
('btrfs', True, FS('btrfs', True)),
('---', False),
('swap', True, FS('swap', False)),
#('bcache cache', True, FS('bcache cache', False)),
#('bcache store', True, FS('bcache store', False)),
('---', False),
('leave unformatted', True, FS(None, False)),
]
@ -417,313 +415,3 @@ class FilesystemModel(object):
if fs.fstype == "swap":
return False
return True
## class AttrDict(dict):
## __getattr__ = dict.__getitem__
## __setattr__ = dict.__setitem__
## class OldFilesystemModel(object):
## """ Model representing storage options
## """
## # TODO: what is "linear" level?
## raid_levels = [
## "0",
## "1",
## "5",
## "6",
## "10",
## ]
## def calculate_raid_size(self, raid_level, raid_devices, spare_devices):
## '''
## 0: array size is the size of the smallest component partition times
## the number of component partitions
## 1: array size is the size of the smallest component partition
## 5: array size is the size of the smallest component partition times
## the number of component partitions munus 1
## 6: array size is the size of the smallest component partition times
## the number of component partitions munus 2
## '''
## # https://raid.wiki.kernel.org/ \
## # index.php/RAID_superblock_formats#Total_Size_of_superblock
## # Version-1 superblock format on-disk layout:
## # Total size of superblock: 256 Bytes plus 2 bytes per device in the
## # array
## log.debug('calc_raid_size: level={} rd={} sd={}'.format(raid_level,
## raid_devices,
## spare_devices))
## overhead_bytes = 256 + (2 * (len(raid_devices) + len(spare_devices)))
## log.debug('calc_raid_size: overhead_bytes={}'.format(overhead_bytes))
## # find the smallest device
## min_dev_size = min([d.size for d in raid_devices])
## log.debug('calc_raid_size: min_dev_size={}'.format(min_dev_size))
## if raid_level == 0:
## array_size = min_dev_size * len(raid_devices)
## elif raid_level == 1:
## array_size = min_dev_size
## elif raid_level == 5:
## array_size = min_dev_size * (len(raid_devices) - 1)
## elif raid_level == 10:
## array_size = min_dev_size * int((len(raid_devices) /
## len(spare_devices)))
## total_size = array_size - overhead_bytes
## log.debug('calc_raid_size: array_size:{} - overhead:{} = {}'.format(
## array_size, overhead_bytes, total_size))
## return total_size
## def add_raid_device(self, raidspec):
## # assume raidspec has already been valided in view/controller
## log.debug('Attempting to create a raid device')
## '''
## raidspec = {
## 'devices': ['/dev/sdb 1.819T, HDS5C3020ALA632',
## '/dev/sdc 1.819T, 001-9YN164',
## '/dev/sdf 1.819T, 001-9YN164',
## '/dev/sdg 1.819T, 001-9YN164',
## '/dev/sdh 1.819T, HDS5C3020ALA632',
## '/dev/sdi 1.819T, 001-9YN164'],
## '/dev/sdj 1.819T, Unknown Model'],
## 'raid_level': '0',
## 'hot_spares': '0',
## 'chunk_size': '4K',
## }
## could be /dev/sda1, /dev/md0, /dev/bcache1, /dev/vg_foo/foobar2?
## '''
## raid_devices = []
## spare_devices = []
## all_devices = [r.split() for r in raidspec.get('devices', [])]
## nr_spares = int(raidspec.get('hot_spares'))
## # XXX: curtin requires a partition table on the base devices
## # and then one partition of type raid
## for (devpath, *_) in all_devices:
## disk = self.get_disk(devpath)
## # add or update a partition to be raid type
## if disk.path != devpath: # we must have got a partition
## raiddev = disk.get_partition(devpath)
## raiddev.flags = 'raid'
## else:
## disk.add_partition(1, disk.freespace, None, None, flag='raid')
## raiddev = disk
## if len(raid_devices) + nr_spares < len(all_devices):
## raid_devices.append(raiddev)
## else:
## spare_devices.append(raiddev)
## # auto increment md number based in registered devices
## raid_shortname = 'md{}'.format(len(self.raid_devices))
## raid_dev_name = '/dev/' + raid_shortname
## raid_serial = '{}_serial'.format(raid_dev_name)
## raid_model = '{}_model'.format(raid_dev_name)
## raid_parttype = 'gpt'
## raid_level = int(raidspec.get('raid_level'))
## raid_size = self.calculate_raid_size(raid_level, raid_devices,
## spare_devices)
## # create a Raiddev (pass in only the names)
## raid_parts = []
## for dev in raid_devices:
## self.set_holder(dev.devpath, raid_dev_name)
## self.set_tag(dev.devpath, 'member of MD ' + raid_shortname)
## for num, action in dev.partitions.items():
## raid_parts.append(action.action_id)
## spare_parts = []
## for dev in spare_devices:
## self.set_holder(dev.devpath, raid_dev_name)
## self.set_tag(dev.devpath, 'member of MD ' + raid_shortname)
## for num, action in dev.partitions.items():
## spare_parts.append(action.action_id)
## raid_dev = Raiddev(raid_dev_name, raid_serial, raid_model,
## raid_parttype, raid_size,
## raid_parts,
## raid_level,
## spare_parts)
## # add it to the model's info dict
## raid_dev_info = {
## 'type': 'disk',
## 'name': raid_dev_name,
## 'size': raid_size,
## 'serial': raid_serial,
## 'vendor': 'Linux Software RAID',
## 'model': raid_model,
## 'is_virtual': True,
## 'raw': {
## 'MAJOR': '9',
## },
## }
## self.info[raid_dev_name] = AttrDict(raid_dev_info)
## # add it to the model's raid devices
## self.raid_devices[raid_dev_name] = raid_dev
## # add it to the model's devices
## self.add_device(raid_dev_name, raid_dev)
## log.debug('Successfully added raid_dev: {}'.format(raid_dev))
## def add_lvm_volgroup(self, lvmspec):
## log.debug('Attempting to create an LVM volgroup device')
## '''
## lvm_volgroup_spec = {
## 'volgroup': 'my_volgroup_name',
## 'devices': ['/dev/sdb 1.819T, HDS5C3020ALA632']
## }
## '''
## lvm_shortname = lvmspec.get('volgroup')
## lvm_dev_name = '/dev/' + lvm_shortname
## lvm_serial = '{}_serial'.format(lvm_dev_name)
## lvm_model = '{}_model'.format(lvm_dev_name)
## lvm_parttype = 'gpt'
## lvm_devices = []
## # extract just the device name for disks in this volgroup
## all_devices = [r.split() for r in lvmspec.get('devices', [])]
## # XXX: curtin requires a partition table on the base devices
## # and then one partition of type lvm
## for (devpath, *_) in all_devices:
## disk = self.get_disk(devpath)
## self.set_holder(devpath, lvm_dev_name)
## self.set_tag(devpath, 'member of LVM ' + lvm_shortname)
## # add or update a partition to be raid type
## if disk.path != devpath: # we must have got a partition
## pv_dev = disk.get_partition(devpath)
## pv_dev.flags = 'lvm'
## else:
## disk.add_partition(1, disk.freespace, None, None, flag='lvm')
## pv_dev = disk
## lvm_devices.append(pv_dev)
## lvm_size = sum([pv.size for pv in lvm_devices])
## lvm_device_names = [pv.id for pv in lvm_devices]
## log.debug('lvm_devices: {}'.format(lvm_device_names))
## lvm_dev = LVMDev(lvm_dev_name, lvm_serial, lvm_model,
## lvm_parttype, lvm_size,
## lvm_shortname, lvm_device_names)
## log.debug('{} volgroup: {} devices: {}'.format(lvm_dev.id,
## lvm_dev.volgroup,
## lvm_dev.devices))
## # add it to the model's info dict
## lvm_dev_info = {
## 'type': 'disk',
## 'name': lvm_dev_name,
## 'size': lvm_size,
## 'serial': lvm_serial,
## 'vendor': 'Linux Volume Group (LVM2)',
## 'model': lvm_model,
## 'is_virtual': True,
## 'raw': {
## 'MAJOR': '9',
## },
## }
## self.info[lvm_dev_name] = AttrDict(lvm_dev_info)
## # add it to the model's lvm devices
## self.lvm_devices[lvm_dev_name] = lvm_dev
## # add it to the model's devices
## self.add_device(lvm_dev_name, lvm_dev)
## log.debug('Successfully added lvm_dev: {}'.format(lvm_dev))
## def add_bcache_device(self, bcachespec):
## # assume bcachespec has already been valided in view/controller
## log.debug('Attempting to create a bcache device')
## '''
## bcachespec = {
## 'backing_device': '/dev/sdc 1.819T, 001-9YN164',
## 'cache_device': '/dev/sdb 1.819T, HDS5C3020ALA632',
## }
## could be /dev/sda1, /dev/md0, /dev/vg_foo/foobar2?
## '''
## backing_device = self.get_disk(bcachespec['backing_device'].split()[0])
## cache_device = self.get_disk(bcachespec['cache_device'].split()[0])
## # auto increment md number based in registered devices
## bcache_shortname = 'bcache{}'.format(len(self.bcache_devices))
## bcache_dev_name = '/dev/' + bcache_shortname
## bcache_serial = '{}_serial'.format(bcache_dev_name)
## bcache_model = '{}_model'.format(bcache_dev_name)
## bcache_parttype = 'gpt'
## bcache_size = backing_device.size
## # create a Bcachedev (pass in only the names)
## bcache_dev = Bcachedev(bcache_dev_name, bcache_serial, bcache_model,
## bcache_parttype, bcache_size,
## backing_device, cache_device)
## # mark bcache holders
## self.set_holder(backing_device.devpath, bcache_dev_name)
## self.set_holder(cache_device.devpath, bcache_dev_name)
## # tag device use
## self.set_tag(backing_device.devpath,
## 'backing store for ' + bcache_shortname)
## cache_tag = self.get_tag(cache_device.devpath)
## if len(cache_tag) > 0:
## cache_tag += ", " + bcache_shortname
## else:
## cache_tag = "cache for " + bcache_shortname
## self.set_tag(cache_device.devpath, cache_tag)
## # add it to the model's info dict
## bcache_dev_info = {
## 'type': 'disk',
## 'name': bcache_dev_name,
## 'size': bcache_size,
## 'serial': bcache_serial,
## 'vendor': 'Linux bcache',
## 'model': bcache_model,
## 'is_virtual': True,
## 'raw': {
## 'MAJOR': '9',
## },
## }
## self.info[bcache_dev_name] = AttrDict(bcache_dev_info)
## # add it to the model's bcache devices
## self.bcache_devices[bcache_dev_name] = bcache_dev
## # add it to the model's devices
## self.add_device(bcache_dev_name, bcache_dev)
## log.debug('Successfully added bcache_dev: {}'.format(bcache_dev))
## def get_bcache_cachedevs(self):
## ''' return uniq list of bcache cache devices '''
## cachedevs = list(set([bcache_dev.cache_device for bcache_dev in
## self.bcache_devices.values()]))
## log.debug('bcache cache devs: {}'.format(cachedevs))
## return cachedevs
## def set_holder(self, held_device, holder_devpath):
## ''' insert a hold on `held_device' by adding `holder_devpath' to
## a list at self.holders[`held_device']
## '''
## if held_device not in self.holders:
## self.holders[held_device] = [holder_devpath]
## else:
## self.holders[held_device].append(holder_devpath)
## def clear_holder(self, held_device, holder_devpath):
## if held_device in self.holders:
## self.holders[held_device].remove(holder_devpath)
## def get_holders(self, held_device):
## return self.holders.get(held_device, [])
## def set_tag(self, device, tag):
## self.tags[device] = tag
## def get_tag(self, device):
## return self.tags.get(device, '')

View File

@ -36,7 +36,6 @@ class LocaleModel(object):
('fr_FR', 'French'),
('de_DE', 'German'),
('el_GR', 'Greek, Modern (1453-)'),
# ('he_IL', 'Hebrew'), # disabled as it does not render correctly on a vt with default font
('hu_HU', 'Hungarian'),
('lv_LV', 'Latvian'),
('nb_NO', 'Norsk bokmål'), # iso_639_3 for nb does not translate Norwgian

View File

@ -92,15 +92,6 @@ class FilesystemView(BaseView):
Text(""),
] + [Padding.push_4(p) for p in self._build_available_inputs()]
#+ [
#self._build_menu(),
#Text(""),
#Text("USED DISKS"),
#Text(""),
#self._build_used_disks(),
#Text(""),
#]
self.lb = Padding.center_95(ListBox(body))
bottom = Pile([
Text(""),
@ -256,26 +247,6 @@ class FilesystemView(BaseView):
def click_partition(self, sender, partition):
self.controller.format_mount_partition(partition)
def _build_menu(self):
log.debug('FileSystemView: building menu')
opts = []
#avail_disks = self.model.get_available_disk_names()
fs_menu = [
# ('Connect iSCSI network disk', 'filesystem:connect-iscsi-disk'),
# ('Connect Ceph network disk', 'filesystem:connect-ceph-disk'),
# ('Create volume group (LVM2)', 'menu:filesystem:main:create-volume-group'),
# ('Create software RAID (MD)', 'menu:filesystem:main:create-raid'),
# ('Setup hierarchichal storage (bcache)', 'menu:filesystem:main:setup-bcache'),
]
for opt, sig in fs_menu:
if len(avail_disks) > 1:
opts.append(menu_btn(label=opt,
on_press=self.on_fs_menu_press,
user_data=sig))
return Pile(opts)
def cancel(self, button=None):
self.controller.default()

View File

@ -119,7 +119,6 @@ class IdentityForm(Form):
(_("No"), True, None),
(_("from Github"), True, "gh"),
(_("from Launchpad"), True, "lp"),
#(_("from Ubuntu One account"), True, "sso"),
],
help=_("You can import your SSH keys from Github or Launchpad."))
import_username = UsernameField(_ssh_import_data[None]['caption'])

View File

@ -35,8 +35,6 @@ def setup_logger(dir):
log.setLevel('DEBUG')
log.setFormatter(
logging.Formatter("%(asctime)s %(name)s:%(lineno)d %(message)s"))
# log_filter = logging.Filter(name='subiquity')
# log.addFilter(log_filter)
logger = logging.getLogger('')
logger.setLevel('DEBUG')

View File

@ -362,12 +362,7 @@ class NetworkModel(object):
""" Model representing network interfaces
"""
additional_options = [
#('Set a custom IPv4 default route', 'menu:network:main:set-default-v4-route'),
#('Set a custom IPv6 default route', 'menu:network:main:set-default-v6-route'),
#('Bond interfaces', 'menu:network:main:bond-interfaces'),
#('Install network driver', 'network:install-network-driver'),
]
additional_options = []
# TODO: what is "linear" level?
bonding_modes = {

View File

@ -65,8 +65,6 @@ class Signal:
urwid.emit_signal(self, 'menu:welcome:main')
def emit_signal(self, name, *args, **kwargs):
# Disabled because it can reveal credentials in the arguments.
#log.debug("Emitter: {}, {}, {}".format(name, args, kwargs))
if name.startswith("menu:"):
log.debug(" emit: before: "
"size={} stack={}".format(len(self.signal_stack),