Skip to content

Instantly share code, notes, and snippets.

Daniel Lobato García dLobatog

Block or report user

Report or block dLobatog

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:2f382f1cd9adfed7581cda530b6defd7
[35] pry(main)> parser.save_rule_references
RuleReference Load (0.5ms) SELECT "rule_references".* FROM "rule_references" WHERE "rule_references"."href" = $1 AND "rule_references"."label" = $2 ORDER BY "rule_references"."label" ASC LIMIT $3 [["href", "https://www.niap-ccevs.org/Profile/PP.cfm"], ["label", "FAU_GEN.1.1.c"], ["LIMIT", 1]]
RuleReference Load (0.8ms) SELECT "rule_references".* FROM "rule_references" WHERE "rule_references"."href" = $1 AND "rule_references"."label" = $2 ORDER BY "rule_references"."label" ASC LIMIT $3 [["href", "https://www.niap-ccevs.org/Profile/PP.cfm"], ["label", "FAU_GEN.1.1.c"], ["LIMIT", 1]]
RuleReference Load (0.4ms) SELECT "rule_references".* FROM "rule_references" WHERE "rule_references"."href" = $1 AND "rule_references"."label" = $2 ORDER BY "rule_references"."label" ASC LIMIT $3 [["href", "https://www.niap-ccevs.org/Profile/PP.cfm"], ["label", "FAU_GEN.1.1.c"], ["LIMIT", 1]]
RuleReference Load (0.3ms) SELECT "rule_references".* FROM "rule_references" W
View gist:9d18276de2e47761988b9824fd058054
def connection
faraday = Faraday.new do |f|
f.response :raise_error
f.adapter Faraday.default_adapter # this must be the last middleware
f.ssl[:verify] = false
end
faraday.basic_auth 'insights-qa', 'redhat'
faraday
end
View gist:0ea95043431c0c38e223bbfb1cdfb860
Host.find_each(100).map do |host|
inventory_host = HostInventoryAPI.new(
host,
host.account,
Settings.host_inventory_url,
host.account.b64identity
).host_already_in_inventory
if inventory_host
old_id = host.id
host.update(id: inventory_host.id)
View gist:fb1bc3109e171af52d997233823f51c1
irb(main):033:0> host = parser.save_host
=> #<Host id: "747db4fd-8221-40f2-bb7c-776fc4671cbb", name: "5.example.com", created_at: nil, updated_at: nil, account_id: "bbc76fb9-de55-490b-903d-ec39d22bf0c7">
irb(main):034:0> host.valid?
=> false
irb(main):035:0> host.errors
=> #<ActiveModel::Errors:0x000000000a5aac30 @base=#<Host id: "747db4fd-8221-40f2-bb7c-776fc4671cbb", name: "5.example.com", created_at: nil, updated_at: nil, account_id: "bbc76fb9-de55-490b-903d-ec39d22bf0c7">, @messages={:profiles=>["is invalid"]}, @details={:profiles=>[{:error=>:invalid}]}>
irb(main):036:0> host.profiles
=> #<ActiveRecord::Associations::CollectionProxy [#<Profile id: "aaf30659-f12b-46c4-8c1e-589dbab528d9", name: "PCI-DSS v3 Control Baseline for Red Hat Enterprise...", ref_id: "xccdf_org.ssgproject.content_profile_pci-dss", policy_id: nil, created_at: "2019-07-09 08:32:34", updated_at: "2019-07-09 08:32:34", description: "This guide presents a catalog of security-relevant...", account_id: "bbc76fb9-de55-490b-903d-ec39d22bf0c
View gist:0ccbed354b93bb6f5ffabf2aa739cdb3
INSERT INTO "rule_references" ("id","href","label") VALUES
('ce7ea772-be9d-4cb4-923b-c901ef18bd7b','http://www.ssi.gouv.fr/administration/bonnes-pratiques/','NT28(R46)'),
('d755a306-cffb-4d90-8339-c43cd2756302','http://www.ssi.gouv.fr/administration/bonnes-pratiques/','NT28(R5)'),
(NULL,'','5.1.1'),
('42af46af-47ed-4f11-8c5e-c2640a05798a','http://iase.disa.mil/stigs/cci/Pages/index.aspx','CCI-001311'),
('860a1562-c21b-4144-9a60-7f69e2e54c84','http://iase.disa.mil/stigs/cci/Pages/index.aspx','CCI-001312'),
('5fadc8fb-377c-4a07-8f38-d8e04b04e0aa','http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf','AU-9(2)'),
('ce7ea772-be9d-4cb4-923b-c901ef18bd7b','http://www.ssi.gouv.fr/administration/bonnes-pratiques/','NT28(R46)'),
('d755a306-cffb-4d90-8339-c43cd2756302','http://www.ssi.gouv.fr/administration/bonnes-pratiques/','NT28(R5)'),
(NULL,'','5.1.2'),
View gist:2545d6aa0156a80cb9127e5d2be18662
dlobatog  lenovolobato  ⋯  workspace  insights  iqe_venv  ENV_FOR_DYNACONF=ci DYNACONF_COMPLIANCE={reliability_test="{num_uploads=3,concurrency_limit=35}"} iqe tests plugin compliance -s -k test_compliance_reliability_async
Plugin path: /home/dlobatog/workspace/insights/iqe_venv/lib/python3.6/site-packages/iqe_compliance
============================================================================================================================= test session starts ==============================================================================================================================
platform linux -- Python 3.6.1, pytest-4.4.1, py-1.8.0, pluggy-0.9.0 -- /home/dlobatog/workspace/insights/iqe_venv/bin/python3.6
cachedir: .pytest_cache
metadata: {'Python': '3.6.1', 'Platform': 'Linux-5.1.15-300.fc30.x86_64-x86_64-with-fedora-30-Thirty', 'Packages': {'pytest': '4.4.1', 'py': '1.8.0', 'pluggy': '0.9.0'}, 'Plugins': {'report-parameters': '0.2', 'polarion-collect': '0.13', 'metadata': '1.8.0', 'html':
View gist:14a39caca58bee912ceb7d521cb86915
# frozen_string_literal: true
require 'prometheus_exporter/client'
RuleType = GraphQL::ObjectType.define do
name 'Rule'
description 'A Rule registered in Insights Compliance'
field :id, !types.ID
field :title, !types.String
View gist:e270c634c644dc3cf0f3b1c844c59ce4
{
"data": {
"allSystems": [
{
"id": "1a8e87ad-8b46-442c-9c6c-6516d333edbd",
"name": "99.example.com",
"profile_names": "PCI-DSS v3 Control Baseline for Red Hat Enterprise Linux 7",
"rules_passed": 971,
"rules_failed": 56,
"last_scanned": "2019-03-06T06:20:13Z",
View gist:5cced0552f4e389920a9bb72dc44b175
curl -u dlobatog@redhat.com:redhat -vvvv -k -F "upload=@dmitri_xccdf_report.xml;type=application/vnd.redhat.compliance.something+tgz" -H "x-rh-insights-request-id: dlobatog" -H "x-rh-identity: eyJpZGVudGl0eSI6eyJhY2NvdW50X251bWJlciI6IjE0NjAyOTAiLCJ0eXBlIjoiVXNlciIsInVzZXIiOnsidXNlcm5hbWUiOiJkbG9iYXRvZ0ByZWRoYXQuY29tIiwiZW1haWwiOiJkbG9iYXRvZytxYUByZWRoYXQuY29tIiwiZmlyc3RfbmFtZSI6IkRhbmllbCIsImxhc3RfbmFtZSI6IkxvYmF0byBHYXJjaWEiLCJpc19hY3RpdmUiOnRydWUsImlzX29yZ19hZG1pbiI6ZmFsc2UsImlzX2ludGVybmFsIjp0cnVlLCJsb2NhbGUiOiJlbl9VUyJ9LCJpbnRlcm5hbCI6eyJvcmdfaWQiOiI2MzQwMDU2In19fQ==" http://localhost:8080/api/ingress/v1/upload
View gist:a228c3406af6a75370aec22951836ee6
�=V�IvO\\u0000\",\"6194200\",\"eyJlbnRpdGxlbWVudHMiOnsiaW5zaWdodHMiOnsiaXNfZW50aXRsZWQiOnRydWV9LCJvcGVuc2hpZnQiOnsiaXNfZW50aXRsZWQiOnRydWV9LCJzbWFydF9tYW5hZ2VtZW50Ijp7ImlzX2VudGl0bGVkIjp0cnVlfSwiaHlicmlkX2Nsb3VkIjp7ImlzX2VudGl0bGVkIjp0cnVlfX0sImlkZW50aXR5Ijp7ImludGVybmFsIjp7ImF1dGhfdGltZSI6MCwiYXV0aF90eXBlIjoiand0LWF1dGgiLCJvcmdfaWQiOiIxMjMyNTQ0MCJ9LCJhY2NvdW50X251bWJlciI6IjYxOTQyMDAiLCJ1c2VyIjp7ImZpcnN0X25hbWUiOiJMaWxsYSIsImlzX2FjdGl2ZSI6dHJ1ZSwiaXNfaW50ZXJuYWwiOmZhbHNlLCJsYXN0X25hbWUiOiJNYXJjaGV3a2EiLCJsb2NhbGUiOiJlbl9VUyIsImlzX29yZ19hZG1pbiI6dHJ1ZSwidXNlcm5hbWUiOiJ3NncyYUB5YWhvby5jb20iLCJlbWFpbCI6IlZ0LmU1QGdtYWlsLmNvbSJ9LCJ0eXBlIjoiVXNlciJ9fQ==\"],\"retry\":3,\"queue\":\"default\",\"backtrace\":true,\"unique\":true,\"jid\":\"c5e2ea2277a40ee7c7fe2bdc\",\"created_at\":1558019435.834335,\"enqueued_at\":1558019435.83439}"}
2019-05-16T15:27:40.590Z 1 TID-ow8u29sxp WARN: ActiveRecord::RecordInvalid: Validation failed: Host must exist, Host can't be blank
2019-05-16T15:27:40.590Z 1 TID-ow8u29sxp WARN: /opt/app-ro
You can’t perform that action at this time.