Skip to content
This repository has been archived by the owner on Oct 24, 2022. It is now read-only.

Fix content-host export organizations #161

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions lib/hammer_cli_csv/content_hosts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -452,10 +452,9 @@ def update_existing(line)
def iterate_hosts(csv)
hypervisors = []
hosts = []
@api.resource(:organizations).call(:index, {
'full_results' => true
})['results'].each do |organization|
next if option_organization && organization['name'] != option_organization
organization_search_options = {:per_page => 999999}
organization_search_options['search'] = "name=\"#{option_organization}\"" if option_organization
@api.resource(:organizations).call(:index, organization_search_options)['results'].each do |organization|

total = @api.resource(:hosts).call(:index, {
'organization_id' => foreman_organization(:name => organization['name']),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20262,6 +20262,83 @@ http_interactions:
}
http_version:
recorded_at: Thu, 06 Apr 2017 01:37:33 GMT
- request:
method: get
uri: https://admin:[email protected]:50083/katello/api/organizations?per_page=999999&search=name=%22Test%20Corporation%22
body:
encoding: US-ASCII
string: ''
headers:
Accept:
- application/json;version=2
Accept-Encoding:
- gzip, deflate
User-Agent:
- rest-client/2.0.0 (linux-gnu x86_64) ruby/2.3.1p112
Content-Type:
- application/json
Accept-Language:
- en
Host:
- devel.example.com:50083
response:
status:
code: 200
message: OK
headers:
Date:
- Thu, 06 Apr 2017 01:37:22 GMT
Server:
- Apache/2.4.6 (Red Hat Enterprise Linux)
X-Frame-Options:
- SAMEORIGIN
X-Xss-Protection:
- 1; mode=block
X-Content-Type-Options:
- nosniff
Foreman-Version:
- 1.11.0.54
Foreman-Api-Version:
- '2'
Apipie-Checksum:
- e1df2e8d43e22495b02a53b48e3b5298
Cache-Control:
- max-age=0, private, must-revalidate
X-Request-Id:
- 1780a474-ea23-47b2-9c06-7cfcff957591
X-Runtime:
- '0.057967'
X-Powered-By:
- Phusion Passenger 4.0.18
Etag:
- '"442ba11ec0703ed2d5c48129111cd2c5-gzip"'
Status:
- 200 OK
Vary:
- Accept-Encoding
Content-Length:
- '388'
Content-Type:
- application/json; charset=utf-8
Set-Cookie:
- _session_id=3e67291d20735ca8f2cb4a97711e8952; path=/; secure; HttpOnly
body:
encoding: ASCII-8BIT
string: |
{
"total": 2,
"subtotal": 1,
"page": 1,
"per_page": 999999,
"search": "name=\"Test Corporation\"",
"sort": {
"by": null,
"order": null
},
"results": [{"label":"testcorp","created_at":"2016-12-01 19:35:26 UTC","updated_at":"2017-03-27 18:36:51 UTC","id":3,"name":"Test Corporation","title":"Test Corporation","description":"Testing today for a better tomorrow"}]
}
http_version:
recorded_at: Thu, 06 Apr 2017 01:37:33 GMT
- request:
method: get
uri: https://admin:[email protected]:50083/katello/api/organizations?per_page=999999&search=name=%22Test%20Corporation%22
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20491,6 +20491,83 @@ http_interactions:
ZW4uaHRtbCJ9fQ==
http_version:
recorded_at: Thu, 06 Apr 2017 01:38:26 GMT
- request:
method: get
uri: https://admin:[email protected]:50083/katello/api/organizations?per_page=999999&search=name=%22Test%20Corporation%22
body:
encoding: US-ASCII
string: ''
headers:
Accept:
- application/json;version=2
Accept-Encoding:
- gzip, deflate
User-Agent:
- rest-client/2.0.0 (linux-gnu x86_64) ruby/2.3.1p112
Content-Type:
- application/json
Accept-Language:
- en
Host:
- devel.example.com:50083
response:
status:
code: 200
message: OK
headers:
Date:
- Thu, 06 Apr 2017 01:38:15 GMT
Server:
- Apache/2.4.6 (Red Hat Enterprise Linux)
X-Frame-Options:
- SAMEORIGIN
X-Xss-Protection:
- 1; mode=block
X-Content-Type-Options:
- nosniff
Foreman-Version:
- 1.11.0.54
Foreman-Api-Version:
- '2'
Apipie-Checksum:
- e1df2e8d43e22495b02a53b48e3b5298
Cache-Control:
- max-age=0, private, must-revalidate
X-Request-Id:
- 847c9d02-28c3-4a87-bf68-698f0a247d8f
X-Runtime:
- '0.045288'
X-Powered-By:
- Phusion Passenger 4.0.18
Etag:
- '"442ba11ec0703ed2d5c48129111cd2c5-gzip"'
Status:
- 200 OK
Vary:
- Accept-Encoding
Content-Length:
- '388'
Content-Type:
- application/json; charset=utf-8
Set-Cookie:
- _session_id=48264994f8a88ce6ca88fb4075a542b3; path=/; secure; HttpOnly
body:
encoding: ASCII-8BIT
string: |
{
"total": 2,
"subtotal": 1,
"page": 1,
"per_page": 999999,
"search": "name=\"Test Corporation\"",
"sort": {
"by": null,
"order": null
},
"results": [{"label":"testcorp","created_at":"2016-12-01 19:35:26 UTC","updated_at":"2017-03-27 18:36:51 UTC","id":3,"name":"Test Corporation","title":"Test Corporation","description":"Testing today for a better tomorrow"}]
}
http_version:
recorded_at: Thu, 06 Apr 2017 01:38:26 GMT
- request:
method: get
uri: https://admin:[email protected]:50083/katello/api/organizations?full_results=true
Expand Down Expand Up @@ -20643,7 +20720,84 @@ http_interactions:
},
"results": [{"label":"testcorp","created_at":"2016-12-01 19:35:26 UTC","updated_at":"2017-03-27 18:36:51 UTC","id":3,"name":"Test Corporation","title":"Test Corporation","description":"Testing today for a better tomorrow"}]
}
http_version:
http_version:
recorded_at: Thu, 06 Apr 2017 01:38:26 GMT
- request:
method: get
uri: https://admin:[email protected]:50083/katello/api/organizations?per_page=999999&search=name=%22Test%20Corporation%22
body:
encoding: US-ASCII
string: ''
headers:
Accept:
- application/json;version=2
Accept-Encoding:
- gzip, deflate
User-Agent:
- rest-client/2.0.0 (linux-gnu x86_64) ruby/2.3.1p112
Content-Type:
- application/json
Accept-Language:
- en
Host:
- devel.example.com:50083
response:
status:
code: 200
message: OK
headers:
Date:
- Thu, 06 Apr 2017 01:38:15 GMT
Server:
- Apache/2.4.6 (Red Hat Enterprise Linux)
X-Frame-Options:
- SAMEORIGIN
X-Xss-Protection:
- 1; mode=block
X-Content-Type-Options:
- nosniff
Foreman-Version:
- 1.11.0.54
Foreman-Api-Version:
- '2'
Apipie-Checksum:
- e1df2e8d43e22495b02a53b48e3b5298
Cache-Control:
- max-age=0, private, must-revalidate
X-Request-Id:
- 847c9d02-28c3-4a87-bf68-698f0a247d8f
X-Runtime:
- '0.045288'
X-Powered-By:
- Phusion Passenger 4.0.18
Etag:
- '"442ba11ec0703ed2d5c48129111cd2c5-gzip"'
Status:
- 200 OK
Vary:
- Accept-Encoding
Content-Length:
- '388'
Content-Type:
- application/json; charset=utf-8
Set-Cookie:
- _session_id=48264994f8a88ce6ca88fb4075a542b3; path=/; secure; HttpOnly
body:
encoding: ASCII-8BIT
string: |
{
"total": 2,
"subtotal": 1,
"page": 1,
"per_page": 999999,
"search": "name=\"Test Corporation\"",
"sort": {
"by": null,
"order": null
},
"results": [{"label":"testcorp","created_at":"2016-12-01 19:35:26 UTC","updated_at":"2017-03-27 18:36:51 UTC","id":3,"name":"Test Corporation","title":"Test Corporation","description":"Testing today for a better tomorrow"}]
}
http_version:
recorded_at: Thu, 06 Apr 2017 01:38:26 GMT
- request:
method: get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21907,6 +21907,83 @@ http_interactions:
ZW4uaHRtbCJ9fQ==
http_version:
recorded_at: Thu, 06 Apr 2017 01:37:02 GMT
- request:
method: get
uri: https://admin:[email protected]:50083/katello/api/organizations?per_page=999999&search=name=%22Test%20Corporation%22
body:
encoding: US-ASCII
string: ''
headers:
Accept:
- application/json;version=2
Accept-Encoding:
- gzip, deflate
User-Agent:
- rest-client/2.0.0 (linux-gnu x86_64) ruby/2.3.1p112
Content-Type:
- application/json
Accept-Language:
- en
Host:
- devel.example.com:50083
response:
status:
code: 200
message: OK
headers:
Date:
- Thu, 06 Apr 2017 01:36:51 GMT
Server:
- Apache/2.4.6 (Red Hat Enterprise Linux)
X-Frame-Options:
- SAMEORIGIN
X-Xss-Protection:
- 1; mode=block
X-Content-Type-Options:
- nosniff
Foreman-Version:
- 1.11.0.54
Foreman-Api-Version:
- '2'
Apipie-Checksum:
- e1df2e8d43e22495b02a53b48e3b5298
Cache-Control:
- max-age=0, private, must-revalidate
X-Request-Id:
- ed005218-dc1f-4df2-b0b5-764f7f8db207
X-Runtime:
- '0.077668'
X-Powered-By:
- Phusion Passenger 4.0.18
Etag:
- '"442ba11ec0703ed2d5c48129111cd2c5-gzip"'
Status:
- 200 OK
Vary:
- Accept-Encoding
Content-Length:
- '388'
Content-Type:
- application/json; charset=utf-8
Set-Cookie:
- _session_id=2951569f09136c02bd43604e110eb2d8; path=/; secure; HttpOnly
body:
encoding: ASCII-8BIT
string: |
{
"total": 2,
"subtotal": 1,
"page": 1,
"per_page": 999999,
"search": "name=\"Test Corporation\"",
"sort": {
"by": null,
"order": null
},
"results": [{"label":"testcorp","created_at":"2016-12-01 19:35:26 UTC","updated_at":"2017-03-27 18:36:51 UTC","id":3,"name":"Test Corporation","title":"Test Corporation","description":"Testing today for a better tomorrow"}]
}
http_version:
recorded_at: Thu, 06 Apr 2017 01:37:03 GMT
- request:
method: get
uri: https://admin:[email protected]:50083/katello/api/organizations?per_page=999999&search=name=%22Test%20Corporation%22
Expand Down
Loading