Merge lp:~allenap/maas/add-remove-tag-using-post--bug-1611711--2.0 into lp:maas/2.0

Proposed by Gavin Panella
Status: Merged
Approved by: Gavin Panella
Approved revision: no longer in the source branch.
Merged at revision: 5188
Proposed branch: lp:~allenap/maas/add-remove-tag-using-post--bug-1611711--2.0
Merge into: lp:maas/2.0
Diff against target: 111 lines (+12/-12)
2 files modified
src/maasserver/api/blockdevices.py (+4/-4)
src/maasserver/api/tests/test_blockdevice.py (+8/-8)
To merge this branch: bzr merge lp:~allenap/maas/add-remove-tag-using-post--bug-1611711--2.0
Reviewer Review Type Date Requested Status
Gavin Panella (community) Approve
Review via email: mp+302911@code.launchpad.net

Commit message

Backport r5236 from lp:maas: Switch BlockDevice.add_tag and remove_tag to be POST operations rather than GET.

To post a comment you must log in.
Revision history for this message
Gavin Panella (allenap) wrote :

Self-review.

review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :
Download full text (1.3 MiB)

The attempt to merge lp:~allenap/maas/add-remove-tag-using-post--bug-1611711--2.0 into lp:maas/2.0 failed. Below is the output from the failed tests.

Hit:1 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:2 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial InRelease
Get:3 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial-updates InRelease [95.7 kB]
Hit:4 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial-backports InRelease
Get:5 http://prodstack-zone-2.clouds.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [314 kB]
Fetched 409 kB in 0s (876 kB/s)
Reading package lists...
sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
    --no-install-recommends install apache2 archdetect-deb authbind bash bind9 bind9utils build-essential bzr bzr-builddeb chromium-browser chromium-chromedriver curl daemontools debhelper dh-apport dh-systemd distro-info dnsutils firefox freeipmi-tools git gjs ipython isc-dhcp-common libjs-angularjs libjs-jquery libjs-jquery-hotkeys libjs-yui3-full libjs-yui3-min libpq-dev make nodejs-legacy npm postgresql pxelinux python3-all python3-apt python3-bson python3-convoy python3-crochet python3-cssselect python3-curtin python3-dev python3-distro-info python3-django python3-django-nose python3-django-piston3 python3-dnspython python3-docutils python3-formencode python3-hivex python3-httplib2 python3-jinja2 python3-jsonschema python3-lxml python3-netaddr python3-netifaces python3-novaclient python3-oauth python3-oauthlib python3-openssl python3-paramiko python3-petname python3-pexpect python3-psycopg2 python3-pyinotify python3-pyparsing python3-pyvmomi python3-requests python3-seamicroclient python3-setuptools python3-simplestreams python3-sphinx python3-tempita python3-twisted python3-txtftp python3-tz python3-yaml python3-zope.interface python-bson python-crochet python-django python-django-piston python-djorm-ext-pgarray python-formencode python-lxml python-netaddr python-netifaces python-pocket-lint python-psycopg2 python-simplejson python-tempita python-twisted python-yaml socat syslinux-common tgt ubuntu-cloudimage-keyring wget xvfb
Reading package lists...
Building dependency tree...
Reading state information...
archdetect-deb is already the newest version (1.117ubuntu2).
authbind is already the newest version (2.1.1+nmu1).
build-essential is already the newest version (12.1ubuntu2).
debhelper is already the newest version (9.20160115ubuntu3).
distro-info is already the newest version (0.14build1).
freeipmi-tools is already the newest version (1.4.11-1ubuntu1).
git is already the newest version (1:2.7.4-0ubuntu1).
libjs-angularjs is already the newest version (1.2.28-1ubuntu2).
libjs-jquery is already the newest version (1.11.3+dfsg-4).
libjs-yui3-full is already the newest version (3.5.1-1ubuntu3).
libjs-yui3-min is already the newest version (3.5.1-1ubuntu3).
make is already the newest version (4.1-6).
postgresql is already the newest version (9.5+173).
pxelinux is already the newest version (3:6.03+dfsg-11ubuntu1).
python-formencode is already the newest version (1.3.0-0ubuntu5).
python-lxml is already the newest version (3.5.0-1build1).
python-netad...

Revision history for this message
Gavin Panella (allenap) wrote :

Spurious failure in maasserver.tests.test_dhcp.TestValidateDHCPConfig.test__calls_validate_for_both_ipv4_and_ipv6.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/api/blockdevices.py'
2--- src/maasserver/api/blockdevices.py 2016-03-28 13:54:47 +0000
3+++ src/maasserver/api/blockdevices.py 2016-08-15 08:43:51 +0000
4@@ -267,7 +267,7 @@
5 else:
6 raise MAASAPIValidationError(form.errors)
7
8- @operation(idempotent=True)
9+ @operation(idempotent=False)
10 def add_tag(self, request, system_id, device_id):
11 """Add a tag to block device on a machine.
12
13@@ -283,11 +283,11 @@
14 if node.status != NODE_STATUS.READY:
15 raise NodeStateViolation(
16 "Cannot update block device because the machine is not Ready.")
17- device.add_tag(get_mandatory_param(request.GET, 'tag'))
18+ device.add_tag(get_mandatory_param(request.POST, 'tag'))
19 device.save()
20 return device
21
22- @operation(idempotent=True)
23+ @operation(idempotent=False)
24 def remove_tag(self, request, system_id, device_id):
25 """Remove a tag from block device on a machine.
26
27@@ -303,7 +303,7 @@
28 if node.status != NODE_STATUS.READY:
29 raise NodeStateViolation(
30 "Cannot update block device because the machine is not Ready.")
31- device.remove_tag(get_mandatory_param(request.GET, 'tag'))
32+ device.remove_tag(get_mandatory_param(request.POST, 'tag'))
33 device.save()
34 return device
35
36
37=== modified file 'src/maasserver/api/tests/test_blockdevice.py'
38--- src/maasserver/api/tests/test_blockdevice.py 2016-05-24 22:05:45 +0000
39+++ src/maasserver/api/tests/test_blockdevice.py 2016-08-15 08:43:51 +0000
40@@ -422,7 +422,7 @@
41 def test_add_tag_returns_403_when_not_admin(self):
42 block_device = factory.make_PhysicalBlockDevice()
43 uri = get_blockdevice_uri(block_device)
44- response = self.client.get(
45+ response = self.client.post(
46 uri, {'op': 'add_tag', 'tag': factory.make_name('tag')})
47 self.assertEqual(
48 http.client.FORBIDDEN, response.status_code, response.content)
49@@ -432,7 +432,7 @@
50 block_device = factory.make_PhysicalBlockDevice()
51 other_node = factory.make_Node()
52 uri = get_blockdevice_uri(block_device, node=other_node)
53- response = self.client.get(
54+ response = self.client.post(
55 uri, {'op': 'add_tag', 'tag': factory.make_name('tag')})
56 self.assertEqual(
57 http.client.NOT_FOUND, response.status_code, response.content)
58@@ -443,7 +443,7 @@
59 status=factory.pick_enum(NODE_STATUS, but_not=[NODE_STATUS.READY]))
60 block_device = factory.make_VirtualBlockDevice(node=node)
61 uri = get_blockdevice_uri(block_device)
62- response = self.client.get(
63+ response = self.client.post(
64 uri, {'op': 'add_tag', 'tag': factory.make_name('tag')})
65 self.assertEqual(
66 http.client.CONFLICT, response.status_code, response.content)
67@@ -454,7 +454,7 @@
68 block_device = factory.make_PhysicalBlockDevice(node=node)
69 tag_to_be_added = factory.make_name('tag')
70 uri = get_blockdevice_uri(block_device)
71- response = self.client.get(
72+ response = self.client.post(
73 uri, {'op': 'add_tag', 'tag': tag_to_be_added})
74
75 self.assertEqual(
76@@ -467,7 +467,7 @@
77 def test_remove_tag_returns_403_when_not_admin(self):
78 block_device = factory.make_PhysicalBlockDevice()
79 uri = get_blockdevice_uri(block_device)
80- response = self.client.get(
81+ response = self.client.post(
82 uri, {'op': 'remove_tag', 'tag': factory.make_name('tag')})
83
84 self.assertEqual(
85@@ -478,7 +478,7 @@
86 block_device = factory.make_PhysicalBlockDevice()
87 other_node = factory.make_Node()
88 uri = get_blockdevice_uri(block_device, node=other_node)
89- response = self.client.get(
90+ response = self.client.post(
91 uri, {'op': 'remove_tag', 'tag': factory.make_name('tag')})
92
93 self.assertEqual(
94@@ -490,7 +490,7 @@
95 status=factory.pick_enum(NODE_STATUS, but_not=[NODE_STATUS.READY]))
96 block_device = factory.make_PhysicalBlockDevice(node=node)
97 uri = get_blockdevice_uri(block_device)
98- response = self.client.get(
99+ response = self.client.post(
100 uri, {'op': 'remove_tag', 'tag': factory.make_name('tag')})
101
102 self.assertEqual(
103@@ -502,7 +502,7 @@
104 block_device = factory.make_PhysicalBlockDevice(node=node)
105 tag_to_be_removed = block_device.tags[0]
106 uri = get_blockdevice_uri(block_device)
107- response = self.client.get(
108+ response = self.client.post(
109 uri, {'op': 'remove_tag', 'tag': tag_to_be_removed})
110
111 self.assertEqual(

Subscribers

People subscribed via source and target branches

to all changes: