Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1379985

Summary: [RFE] Clone role from CLI and API
Product: Red Hat Satellite Reporter: Jitendra Yejare <jyejare>
Component: Users & RolesAssignee: Ondřej Pražák <oprazak>
Status: CLOSED ERRATA QA Contact: Adam Ruzicka <aruzicka>
Severity: medium Docs Contact:
Priority: high    
Version: 6.3.0CC: aruzicka, bbuckingham, jcallaha
Target Milestone: UnspecifiedKeywords: FutureFeature, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1470675 (view as bug list) Environment:
Last Closed: 2018-02-21 16:49:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1373844    

Description Jitendra Yejare 2016-09-28 11:05:40 UTC
Description of problem:
Currently role cannot be cloned from CLI and API,  and can only be cloned from UI. This RFE is to add that support.

Version-Release number of selected component (if applicable):
Satellite 6.3 snap 2

How reproducible:


Steps to Reproduce:
1. Attempt to clone a role from CLI and API
2.
3.

Actual results:
No option to clone a Role from CLI hammer or API.

Expected results:
Support should be added to clone a role from CLI and API.

Additional info:

Comment 1 Ondřej Pražák 2017-01-31 12:18:30 UTC
Created redmine issue http://projects.theforeman.org/issues/18317 from this bug

Comment 2 Ondřej Pražák 2017-01-31 12:26:00 UTC
Connecting redmine issue http://projects.theforeman.org/issues/18318 from this bug

Comment 3 Satellite Program 2017-03-14 12:04:11 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/18318 has been resolved.

Comment 4 Adam Ruzicka 2017-08-02 09:23:29 UTC
Verified.
Satellite-6.3 Snap 9
Package versions:
satellite-6.3.0-16.0.beta.el7sat.noarch
tfm-rubygem-hammer_cli-0.10.2-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman-0.10.2-1.el7sat.noarch

[root@snap9 ~]# hammer role clone --id 1 --new-name 'Cloned Tasks Managed'
User role cloned

[root@snap9 ~]# cat role_clone
{
        "name": "Cloned Tasks Manager 2"
}

[root@snap9 ~]# curl -X POST -k -H 'Content-Type: application/json' https://localhost/api/v2/roles/1/clone -u $LOGIN -d "$(<role_clone)" -i
HTTP/1.1 201 Created
Date: Wed, 02 Aug 2017 09:22:47 GMT
Server: Apache/2.4.6 (CentOS)
Foreman_version: 1.15.2
Foreman_api_version: 2
Apipie-Checksum: d27105eaf95e8a9c5bddae9e0d6aca3f
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: beef6c09-aaa2-4ebb-9182-3a94eb950837
X-Runtime: 0.117654
Content-Security-Policy: default-src 'self'; child-src 'self'; connect-src 'self' ws: wss:; img-src 'self' data: *.gravatar.com; script-src 'unsafe-eval' 'unsafe-inline' 'self'; style-src 'unsafe-inline' 'self'
Strict-Transport-Security: max-age=631152000; includeSubdomains
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Frame-Options: sameorigin
X-Permitted-Cross-Domain-Policies: none
X-XSS-Protection: 1; mode=block
X-Powered-By: Phusion Passenger 4.0.18
Set-Cookie: request_method=POST; path=/
Set-Cookie: _session_id=8a32e013079b304b2961f9f6a2dcf155; path=/; secure; HttpOnly
Location: https://localhost/roles/27-Cloned%20Tasks%20Manager%202
ETag: W/"ea2b6a48ace431aa687bba7aace3c5ea"
Status: 201 Created
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8

{"id":27,"name":"Cloned Tasks Manager 2","builtin":0,"description":null,"origin":null,"cloned_from_id":1}

Comment 5 Satellite Program 2018-02-21 16:49:54 UTC
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.

https://access.redhat.com/errata/RHSA-2018:0336