Skip to content

Commit

Permalink
Fix moving hosts between allocs in cueadmin. (#654)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcipriano committed Apr 27, 2020
1 parent e6879f3 commit ad2c754
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cueadmin/cueadmin/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ def handleArgs(args):
def moveHosts(hosts_, dst_):
for host_ in hosts_:
logger.debug("moving %s to %s" % (opencue.rep(host_), opencue.rep(dst_)))
host_.setAllocation(dst_.data)
host_.setAllocation(dst_)

confirm("Move %d hosts to %s" % (len(hosts), args.move),
args.force, moveHosts, hosts, opencue.api.findAllocation(args.move))
Expand Down
11 changes: 6 additions & 5 deletions cueadmin/tests/common_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,16 +391,17 @@ def testInvalidUnlockHost(self, getStubMock, hostSearchMock):
def testMoveHost(self, findAllocMock, getStubMock, hostSearchMock):
allocName = '%s.%s' % (TEST_FACILITY, TEST_ALLOC)
args = self.parser.parse_args(['-move', allocName, '-host', TEST_HOST, '-force'])
hostMock = mock.Mock()
hostSearchMock.byName.return_value = [hostMock]
allocMock = mock.Mock()
findAllocMock.return_value = allocMock
host = opencue.wrappers.host.Host(opencue.compiled_proto.host_pb2.Host())
host.setAllocation = mock.Mock()
hostSearchMock.byName.return_value = [host]
alloc = opencue.wrappers.allocation.Allocation()
findAllocMock.return_value = alloc

cueadmin.common.handleArgs(args)

hostSearchMock.byName.assert_called_with([TEST_HOST])
findAllocMock.assert_called_with(allocName)
hostMock.setAllocation.assert_called_with(allocMock.data)
host.setAllocation.assert_called_with(alloc)

def testInvalidMoveHost(self, getStubMock, hostSearchMock):
args = self.parser.parse_args(['-move', TEST_ALLOC, '-force'])
Expand Down

0 comments on commit ad2c754

Please sign in to comment.
  翻译: