This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 1004335 - importing organization with "/" in the name from Sat5.6.0 fails with katello.client.server.ServerRequestError: (422, {u'displayMessage': u'Validation failed: Name cannot contain characters >, <, or /'...
importing organization with "/" in the name from Sat5.6.0 fails with katello....
Status: CLOSED ERRATA
Product: Subscription Asset Manager
Classification: Red Hat
Component: Splice (Show other bugs)
Nightly
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Splice Developers
mkovacik
:
Depends On:
Blocks: sam13-tracker 1004396
  Show dependency treegraph
 
Reported: 2013-09-04 08:38 EDT by Jan Hutař
Modified: 2017-02-20 11:33 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1004396 (view as bug list)
Environment:
Last Closed: 2013-10-01 07:23:28 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jan Hutař 2013-09-04 08:38:08 EDT
Description of problem:
You are unable to transfer organization with "/" in name using Splice and what is worse, when you attempt to, you get your SAM to inconsistent state.


Version-Release number of selected component (if applicable):
SAM 1.3 snapshot #4
katello-headpin-all-1.4.3-11.el6sam_splice.noarch
spacewalk-splice-tool-0.40-1.el6sam.noarch
splice-0.144-1.el6sam.noarch
ruby193-rubygem-splice_reports-0.0.8-1.el6sam.noarch


How reproducible:
always


Steps to Reproduce:
1. On Satellite 5.6.0 create organization to "AC/DC"
2. Setup sync through Splice to SAM 1.3 snapshot #4
3. As swreport user run spacewalk-splice-checkin


Actual results:
Traceback (most recent call last):
  File "/usr/bin/spacewalk-splice-checkin", line 97, in <module>
    checkin.main(opts)
  File "/usr/lib/python2.6/site-packages/spacewalk_splice_tool/checkin.py", line 206, in main
    spacewalk_sync(options)
  File "/usr/lib/python2.6/site-packages/spacewalk_splice_tool/checkin.py", line 139, in spacewalk_sync
    kps.update_owners(org_list)
  File "/usr/lib/python2.6/site-packages/spacewalk_splice_tool/katello_sync.py", line 66, in update_owners
    self.katello_client.create_org_admin_role_permission(kt_org_label=orgs[org_id])
  File "/usr/lib/python2.6/site-packages/spacewalk_splice_tool/katello_connect.py", line 227, in create_org_admin_role_permission
    role = self.rolesapi.create(name="Org Admin Role for %s" % kt_org_label, description="generated from spacewalk")
  File "/usr/lib/python2.6/site-packages/katello/client/api/user_role.py", line 30, in create
    return self.server.POST(path, {"role": data})[1]
  File "/usr/lib/python2.6/site-packages/katello/client/server.py", line 454, in POST
    return self._request('POST', path, body=body, multipart=multipart, custom_headers=custom_headers)
  File "/usr/lib/python2.6/site-packages/katello/client/server.py", line 250, in _request
    return self._process_response(connection.getresponse())
  File "/usr/lib/python2.6/site-packages/katello/client/server.py", line 308, in _process_response
    raise ServerRequestError(response.status, response_body, None)
katello.client.server.ServerRequestError: (422, {u'displayMessage': u'Validation failed: Name cannot contain characters >, <, or /', u'errors': [u'Validation failed: Name cannot contain characters >, <, or /']}, None)


Expected results:
Should work


Additional info:
Problem is, that once you run this again, you will get:
Traceback (most recent call last):
  File "/usr/bin/spacewalk-splice-checkin", line 97, in <module>
    checkin.main(opts)
  File "/usr/lib/python2.6/site-packages/spacewalk_splice_tool/checkin.py", line 206, in main
    spacewalk_sync(options)
  File "/usr/lib/python2.6/site-packages/spacewalk_splice_tool/checkin.py", line 141, in spacewalk_sync
    kps.update_roles(sw_user_list)
  File "/usr/lib/python2.6/site-packages/spacewalk_splice_tool/katello_sync.py", line 166, in update_roles
    self.katello_client.grant_org_admin(kt_user=kt_users[kt_username], kt_org_label=sw_user_org)
  File "/usr/lib/python2.6/site-packages/spacewalk_splice_tool/katello_connect.py", line 239, in grant_org_admin
    self.userapi.assign_role(user_id=kt_user['id'], role_id=oa_role['id'])
TypeError: 'NoneType' object is unsubscriptable

This is because role for this organization do not exist.
Comment 3 Chris Duryee 2013-09-04 16:12:01 EDT
Milan,

I have it currently set up to log an error message and abort. If you run it from the command-line, you will see:

-bash-4.1$ spacewalk-splice-checkin --spacewalk-sync --report_input=/tmp
Traceback (most recent call last):
  File "/usr/bin/spacewalk-splice-checkin", line 97, in <module>
    checkin.main(opts)
  File "/usr/lib/python2.6/site-packages/spacewalk_splice_tool/checkin.py", line 225, in main
    spacewalk_sync(options)
  File "/usr/lib/python2.6/site-packages/spacewalk_splice_tool/checkin.py", line 153, in spacewalk_sync
    raise Exception("Invalid org names found. Check /var/log/splice/spacewalk-splice-tool.log for more detail.")
Exception: Invalid org names found. Check /var/log/splice/spacewalk-splice-tool.log for more detail.


and in the log:

2013-09-04 15:59:53,706 ERROR: PID 17015 spacewalk_splice_tool.checkin checkin:check_for_invalid_org_names:115        org names may not contain '/' character: Org/Two

It also checks for '<' and '>'

Once the underlying katello bug is fixed, I can remove the filter. Is this what you had in mind in comment #2?


NOTE: I was getting cron emails from this warning:
/usr/lib/python2.6/site-packages/spacewalk_splice_tool/checkin.py:45: SyntaxWarning: name 'CERT_DIR' is used prior to global declaration
  global CERT_DIR

I am going to fix that as well in this commit.
Comment 4 mkovacik 2013-09-05 05:19:33 EDT
> Is this what you had in mind in comment #2?(In reply to Chris Duryee from comment #3)
precisely, thank you!
Comment 5 Chris Duryee 2013-09-05 11:08:20 EDT
aeae0635 spacewalk-splice-tool 0.41+
Comment 6 mkovacik 2013-09-05 11:51:51 EDT
Reproduced with snapshot #4; org name: "Testing/Org"

[root@ec2-54-253-143-184 ~]# sudo -u splice spacewalk-splice-checkin                                                                                                                                                                 
[Errno 13] Permission denied: '/var/log/splice/splice.log'
Unable to initialize logging config with: /etc/splice/logging/basic.cfg
Traceback (most recent call last):
  File "/usr/bin/spacewalk-splice-checkin", line 97, in <module>
    checkin.main(opts)
  File "/usr/lib/python2.6/site-packages/spacewalk_splice_tool/checkin.py", line 206, in main
    spacewalk_sync(options)
  File "/usr/lib/python2.6/site-packages/spacewalk_splice_tool/checkin.py", line 141, in spacewalk_sync
    kps.update_roles(sw_user_list)
  File "/usr/lib/python2.6/site-packages/spacewalk_splice_tool/katello_sync.py", line 166, in update_roles
    self.katello_client.grant_org_admin(kt_user=kt_users[kt_username], kt_org_label=sw_user_org)
  File "/usr/lib/python2.6/site-packages/spacewalk_splice_tool/katello_connect.py", line 236, in grant_org_admin
    self.userapi.assign_role(user_id=kt_user['id'], role_id=oa_role['id'])
Comment 7 mkovacik 2013-09-05 11:59:29 EDT
# spacewalk-splice-tool-0.41-1.el6sam.noarch solves the issue

[root@ec2-54-253-143-184 ~]# rpm -q spacewalk-splice-tool
spacewalk-splice-tool-0.41-1.el6sam.noarch

[root@ec2-54-253-143-184 ~]# sudo -u splice spacewalk-splice-checkin 
Traceback (most recent call last):
  File "/usr/bin/spacewalk-splice-checkin", line 97, in <module>
    checkin.main(opts)
  File "/usr/lib/python2.6/site-packages/spacewalk_splice_tool/checkin.py", line 225, in main
    spacewalk_sync(options)
  File "/usr/lib/python2.6/site-packages/spacewalk_splice_tool/checkin.py", line 154, in spacewalk_sync
    raise Exception("Invalid org names found. Check /var/log/splice/spacewalk_splice_tool.log for more detail.")
Exception: Invalid org names found. Check /var/log/splice/spacewalk_splice_tool.log for more detail.
[root@ec2-54-253-143-184 ~]# tail /var/log/splice/spacewalk_splice_tool.log 
2013-09-03 16:33:09,144 INFO: PID 6583 spacewalk_splice_tool.checkin checkin:splice_sync:187        fetching deleted systems...
2013-09-03 16:33:09,209 INFO: PID 6583 spacewalk_splice_tool.checkin checkin:splice_sync:191        uploading to splice...
2013-09-03 16:33:09,209 INFO: PID 6583 spacewalk_splice_tool.splice_push splice_push:_build_server_metadata:57        building server metadata
2013-09-03 16:33:09,210 INFO: PID 6583 spacewalk_splice_tool.splice_push splice_push:upload_to_rcs:119        sending metadata to server
2013-09-03 16:33:12,483 INFO: PID 6583 spacewalk_splice_tool.checkin checkin:splice_sync:193        Upload was successful
2013-09-03 16:33:12,483 INFO: PID 6583 spacewalk_splice_tool.checkin checkin:main:211        run complete
2013-09-05 11:56:44,832 INFO: PID 12281 spacewalk_splice_tool.checkin checkin:main:220        run starting
2013-09-05 11:56:44,833 INFO: PID 12281 spacewalk_splice_tool.checkin checkin:spacewalk_sync:138        Started capturing system data from spacewalk
2013-09-05 11:56:44,833 INFO: PID 12281 spacewalk_splice_tool.checkin checkin:spacewalk_sync:146        retrieving data from spacewalk
2013-09-05 11:56:46,221 ERROR: PID 12281 spacewalk_splice_tool.checkin checkin:check_for_invalid_org_names:115        org names may not contain '/' character: Testing/Org
Comment 8 Vitaly Kuznetsov 2013-09-13 10:04:00 EDT
Verified with Snapshot 6:

# sudo -u splice spacewalk-splice-checkin
Traceback (most recent call last):
  File "/usr/bin/spacewalk-splice-checkin", line 100, in <module>
    checkin.main(opts)
  File "/usr/lib/python2.6/site-packages/spacewalk_splice_tool/checkin.py", line 225, in main
    spacewalk_sync(options)
  File "/usr/lib/python2.6/site-packages/spacewalk_splice_tool/checkin.py", line 154, in spacewalk_sync
    raise Exception("Invalid org names found. Check /var/log/splice/spacewalk_splice_tool.log for more detail.")
Exception: Invalid org names found. Check /var/log/splice/spacewalk_splice_tool.log for more detail.
[root@ec2-54-216-163-158 ~]# tail -10 /var/log/splice/spacewalk_splice_tool.log
2013-09-13 10:02:53,967 INFO: PID 24636 spacewalk_splice_tool.checkin checkin:splice_sync:206        fetching deleted systems...
2013-09-13 10:02:54,160 INFO: PID 24636 spacewalk_splice_tool.checkin checkin:splice_sync:210        uploading to splice...
2013-09-13 10:02:54,161 INFO: PID 24636 spacewalk_splice_tool.splice_push splice_push:_build_server_metadata:57        building server metadata
2013-09-13 10:02:54,161 INFO: PID 24636 spacewalk_splice_tool.splice_push splice_push:upload_to_rcs:119        sending metadata to server
2013-09-13 10:02:54,378 INFO: PID 24636 spacewalk_splice_tool.checkin checkin:splice_sync:212        Upload was successful
2013-09-13 10:02:54,378 INFO: PID 24636 spacewalk_splice_tool.checkin checkin:main:230        run complete
2013-09-13 10:03:12,738 INFO: PID 24836 spacewalk_splice_tool.checkin checkin:main:220        run starting
2013-09-13 10:03:12,739 INFO: PID 24836 spacewalk_splice_tool.checkin checkin:spacewalk_sync:138        Started capturing system data from spacewalk
2013-09-13 10:03:12,739 INFO: PID 24836 spacewalk_splice_tool.checkin checkin:spacewalk_sync:146        retrieving data from spacewalk
2013-09-13 10:03:15,161 ERROR: PID 24836 spacewalk_splice_tool.checkin checkin:check_for_invalid_org_names:115        org names may not contain '/' character: Testing/Org
Comment 10 errata-xmlrpc 2013-10-01 07:23:28 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHEA-2013-1390.html

Note You need to log in before you can comment on or make changes to this bug.