Permalink
Browse files

Revert "Change when new unpropagate targets are translated in wsc"

This reverts commit bbc5649.
  • Loading branch information...
1 parent bbc5649 commit 0212f37cae543d180778460ea8e1dd24bcfbafc8 @oldpatricka oldpatricka committed Jun 7, 2011
@@ -260,7 +260,7 @@ def obtain(self):
# client requesting new names
unproptargets_arg = self.p.get_arg_or_none(wc_args.UNPROPTARGETS)
if unproptargets_arg:
- self._validate_new_unproptargets(l_files, unproptargets_arg)
+ self._process_new_unproptargets(l_files, unproptargets_arg)
elif action in [ACTIONS.REMOVE]:
@@ -528,10 +528,6 @@ def _process_image_args(self, unprop=False):
imgstrs = images.split(';;')
- unproptargets_arg = self.p.get_arg_or_none(wc_args.UNPROPTARGETS)
- if unprop and unproptargets_arg:
- imgstrs = self._get_new_unprop_targets(imgstrs, unproptargets_arg)
-
i = 0
l_files = []
for imgstr in imgstrs:
@@ -747,9 +743,9 @@ def _one_imagestr_blankcreate(self, lf, imgstr):
if self.c.trace:
self.c.log.debug("partition of size %dM is going to be created (blankcreate) at '%s'" % (lf._blankspace, lf.path))
-
+
def _one_imagestr_propagation(self, lf, imgstr, unprop):
-
+
for keyword in self.adapters.keys():
schemestring = keyword + "://"
schemestring_len = len(schemestring)
@@ -797,32 +793,8 @@ def _one_imagestr_propagation(self, lf, imgstr, unprop):
###this host but it does not exist: '%s'" % lf.path)
return
-
- def _get_new_unprop_targets(self, original_images, unproptargets_arg):
-
- images = list(original_images)
-
- if unproptargets_arg[0] == "'":
- unproptargets_arg = unproptargets_arg[1:]
- # (there is a pathological case where input was only a single quote)
- if unproptargets_arg and unproptargets_arg[-1] == "'":
- unproptargets_arg = unproptargets_arg[:-1]
-
- unproptargets = unproptargets_arg.split(';;')
-
- for i, image in enumerate(images):
- try:
- old_image = images[i]
- images[i] = unproptargets[i]
- except IndexError:
- # No unprop target with to match
- break
- self.c.log.debug("old unpropagation target '%s' is now '%s'" % (old_image, images[i]))
-
- return images
-
-
- def _validate_new_unproptargets(self, l_files, unproptargets_arg):
+
+ def _process_new_unproptargets(self, l_files, unproptargets_arg):
# The given input string might be quoted to escape semicolons for
# certain delivery methods (e.g., sh over ssh) and some methods may
@@ -853,6 +825,15 @@ def _validate_new_unproptargets(self, l_files, unproptargets_arg):
if len(unproptargets) != num_needs:
raise InvalidInput("received %s argument but cannot match unpropagations scheduled with targets. There are %d unprop-targets and %d unpropagation needs" % (argname, len(unproptargets), num_needs))
+ # note how the order is assumed to match -- this is a precarious side
+ # effect of the commandline based syntax
+ counter = -1
+ for lf in l_files:
+ if lf._unpropagate_needed:
+ counter += 1
+ old = lf._unpropagation_target
+ lf._unpropagation_target = unproptargets[counter]
+ self.c.log.debug("old unpropagation target '%s' is now '%s'" % (old, lf._unpropagation_target))
def url_parse(url):
parts = url.split('://', 1)
@@ -493,7 +493,7 @@ def test_real_procurement_unpropagate3():
(opts, args) = parser.parse_args(createargs)
p,c = get_pc(opts, realconfigs())
- c.log.debug("test_real_procurement_unpropagate3()")
+ c.log.debug("test_real_procurement_unpropagate2()")
procure_cls = c.get_class_by_keyword("ImageProcurement")
procure = procure_cls(p, c)
@@ -506,25 +506,6 @@ def test_real_procurement_unpropagate3():
invalid_input = True
assert invalid_input
-def test_real_procurement_unpropagate4():
- """Test the procurement adapter unpropagate with new name"""
-
- handle = "wrksp-2133"
- createargs = ["--action", "unpropagate",
- "--name", handle,
- "--images", "http://somehost/some-base-cluster-01.gz",
- "--unproptargets", "scp://somehost/some-base-cluster-02.gz"
- ]
- parser = wc_optparse.parsersetup()
- (opts, args) = parser.parse_args(createargs)
-
- p,c = get_pc(opts, mockconfigs(basename="httpenabled.conf"))
- c.log.debug("test_real_procurement_unpropagate4()")
-
- procure_cls = c.get_class_by_keyword("ImageProcurement")
- procure = procure_cls(p, c)
- procure.validate()
- assert procure.lengthy_shutdown()
def test_notification():
"""Test notification validation (negative1)"""
@@ -1,79 +0,0 @@
-# The confs don't actually need to be separate files, that is just a mechanism
-# for the end user's sanity. In the case where the configurations are equal and
-# are likely always going to be equal, we use the real conf file (see the
-# otherconfs section).
-
-[otherconfs]
-
-logging: ../../../../../etc/workspace-control/logging.conf
-dirs: ../../../../../etc/workspace-control/dirs.conf
-kernels: ../../../../../etc/workspace-control/kernels.conf
-mount: ../../../../../etc/workspace-control/mount.conf
-sudo: ../../../../../etc/workspace-control/sudo.conf
-images: ../../../../../etc/workspace-control/images.conf
-
-[libvirt]
-
-vmm: mock
-template: libvirt_template.xml
-
-[wcimpls]
-
-# Real:
-KernelProcurement: workspacecontrol.defaults.DefaultKernelProcurement
-ImageEditing: workspacecontrol.defaults.DefaultImageEditing
-NetworkBootstrap: workspacecontrol.defaults.DefaultNetworkBootstrap
-NetworkSecurity: workspacecontrol.defaults.DefaultNetworkSecurity
-
-
-# This is the default and real workspace control module, but we (above)
-# configure libvirt to use the mock driver:
-Platform: workspacecontrol.defaults.lvrt.Platform
-
-
-# Mocks:
-ImageProcurement: workspacecontrol.defaults.DefaultImageProcurement
-LocalNetworkSetup: workspacecontrol.mocks.LocalNetworkSetup
-NetworkLease: workspacecontrol.mocks.NetworkLease
-
-
-# All of these default objects can be used with the tests even though
-# they are not mocks:
-
-Common: workspacecontrol.defaults.Common.DefaultCommon
-DNS: workspacecontrol.defaults.DNS.DefaultDNS
-Kernel: workspacecontrol.defaults.Kernel.DefaultKernel
-LocalFile: workspacecontrol.defaults.LocalFile.DefaultLocalFile
-LocalFileSet: workspacecontrol.defaults.LocalFileSet.DefaultLocalFileSet
-NIC: workspacecontrol.defaults.NIC.DefaultNIC
-NICSet: workspacecontrol.defaults.NICSet.DefaultNICSet
-Parameters: workspacecontrol.defaults.Parameters.DefaultParameters
-RunningVM: workspacecontrol.defaults.RunningVM.DefaultRunningVM
-
-
-[defaultbridge]
-default: virbr1
-
-[bridges]
-virbr3: 10.0.0.0/24
-
-[dhcp-bridges]
-virbr1: vif0.1
-virbr3: vif0.2
-
-[dhcp]
-dhcpconfig: dhcp-config.sh
-
-[netsecurity]
-ebtablesconfig: xen-ebtables-config.sh
-
-[propagation]
-scp: /usr/bin/scp
-cp: /bin/cp
-http: true
-https: true
-lantorrent: false
-lantorrentport: 2893
-ssh: /usr/bin/ssh
-lantorrentexe: /opt/nimbus/bin/ltclient.sh
-

0 comments on commit 0212f37

Please sign in to comment.