Skip to content

Instantly share code, notes, and snippets.

@ashish1099
Last active November 4, 2016 04:05
Show Gist options
  • Save ashish1099/94ac418e28ab74ad14db to your computer and use it in GitHub Desktop.
Save ashish1099/94ac418e28ab74ad14db to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
def xmlparse(role,osx)
totaltest = Dir.glob("/var/log/beaker/spec/reports/#{role}/#{osx}/latest/*.xml").count
Dir["/var/log/beaker/spec/reports/#{role}/#{osx}/latest/*.xml"].each do |k|
successtest = 0
system "grep 'failures=\"0\"' #{k} "
if $?.exitstatus == 0
suc = successtest += 1
puts "passed #{totaltest}/#{suc}"
else
"failed"
end
end
end
puts xmlparse("role::webframeworks::lamp","centos7")
root@beaker04:~# ./b.rb
<testsuite name="check role::lamp class check mysql in role::lamp" tests="1" time="0.027724081" failures="0" errors="0" skipped="0" timestamp="2015-06-15T09:30:59+00:00">
passed 38/01
<testsuite name="check role::lamp class check php modules in role::lamp Command &quot;php -m&quot; stdout" tests="1" time="0.001467734" failures="0" errors="0" skipped="0" timestamp="2015-06-15T09:30:59+00:00">
passed 38/01
<testsuite name="check role::lamp class check mysql in role::lamp Port &quot;3306&quot;" tests="1" time="0.022808263" failures="0" errors="0" skipped="0" timestamp="2015-06-15T09:30:59+00:00">
passed 38/01
<testsuite name="check role::lamp class check apache in role::lamp Package &quot;httpd&quot;" tests="1" time="0.151545629" failures="0" errors="0" skipped="0" timestamp="2015-06-15T09:30:58+00:00">
passed 38/01
<testsuite name="check role::lamp class check php modules in role::lamp Command &quot;php -m&quot; stdout" tests="1" time="0.001412422" failures="0" errors="0" skipped="0" timestamp="2015-06-15T09:30:59+00:00">
passed 38/01
<testsuite name="check role::lamp class check php modules in role::lamp Command &quot;php -m&quot; stdout" tests="1" time="0.001430021" failures="0" errors="0" skipped="0" timestamp="2015-06-15T09:30:59+00:00">
passed 38/01
<testsuite name="check role::lamp class check mysql in role::lamp mon user should be able to login Command &quot;mysqladmin -umom -PM0n1t0r#2 ping | grep -c &quot;mysqld is alive&quot;&quot; stdout" tests="1" time="0.023861712" failures="0" errors="0" skipped="0" timestamp="2015-06-15T09:30:59+00:00">
passed 38/01
<testsuite name="check role::lamp class check phpmyadmin dir in role::lamp File &quot;/usr/share/phpmyadmin&quot;" tests="1" time="0.015857338" failures="0" errors="0" skipped="0" timestamp="2015-06-15T09:30:59+00:00">
passed 38/01
<testsuite name="check role::lamp class check php modules in role::lamp Command &quot;php -m&quot; stdout" tests="1" time="0.001471366" failures="0" errors="0" skipped="0" timestamp="2015-06-15T09:30:59+00:00">
passed 38/01
<testsuite name="check role::lamp class check php modules in role::lamp Command &quot;php -m&quot; stdout" tests="1" time="0.001462426" failures="0" errors="0" skipped="0" timestamp="2015-06-15T09:30:59+00:00">
passed 38/01
<testsuite name="check role::lamp class check apache in role::lamp Service &quot;httpd&quot;" tests="2" time="0.047891037" failures="0" errors="0" skipped="0" timestamp="2015-06-15T09:30:59+00:00">
passed 38/01
<testsuite name="check role::lamp class check php modules in role::lamp Command &quot;php -m&quot; stdout" tests="1" time="0.001441475" failures="0" errors="0" skipped="0" timestamp="2015-06-15T09:30:59+00:00">
passed 38/01
<testsuite name="check role::lamp class check php modules in role::lamp Command &quot;php -m&quot; stdout" tests="1" time="0.001423037" failures="0" errors="0" skipped="0" timestamp="2015-06-15T09:30:59+00:00">
passed 38/01
<testsuite name="check role::lamp class check phpmyadmin from outside in role::lamp Command &quot;curl -I -k https://centos-7-role-lamp-lxc-07.ashish&quot; stdout" tests="1" time="0.410351494" failures="0" errors="0" skipped="0" timestamp="2015-06-15T09:30:59+00:00">
passed 38/01
<testsuite name="check role::lamp class check selinux in role::lamp on Redhat osfamily SELinux" tests="1" time="0.0224018" failures="0" errors="0" skipped="0" timestamp="2015-06-15T09:30:59+00:00">
passed 38/01
<testsuite name="check role::lamp class check php modules in role::lamp Command &quot;php -m&quot; stdout" tests="1" time="0.001499021" failures="0" errors="0" skipped="0" timestamp="2015-06-15T09:30:59+00:00">
passed 38/01
<testsuite name="check role::lamp class check phpmyadmin dir in role::lamp File &quot;/opt/vhosts.d/25-centos-7-role-lamp-lxc-07.ashish.conf&quot;" tests="2" time="0.080340138" failures="0" errors="0" skipped="0" timestamp="2015-06-15T09:30:59+00:00">
passed 38/01
<testsuite name="check role::lamp class check php modules in role::lamp Command &quot;php -m&quot; stdout" tests="1" time="0.001453487" failures="0" errors="0" skipped="0" timestamp="2015-06-15T09:30:59+00:00">
passed 38/01
<testsuite name="check role::lamp class check apache in role::lamp Port &quot;80&quot;" tests="1" time="0.022557959" failures="0" errors="0" skipped="0" timestamp="2015-06-15T09:30:59+00:00">
passed 38/01
<testsuite name="check role::lamp class check mysql in role::lamp Package &quot;mariadb-server&quot;" tests="1" time="0.050592126" failures="0" errors="0" skipped="0" timestamp="2015-06-15T09:30:59+00:00">
passed 38/01
<testsuite name="check role::lamp class check php modules in role::lamp Command &quot;php -m&quot; stdout" tests="1" time="0.00143477" failures="0" errors="0" skipped="0" timestamp="2015-06-15T09:30:59+00:00">
passed 38/01
<testsuite name="check role::lamp class check apache in role::lamp Port &quot;443&quot;" tests="1" time="0.023210255" failures="0" errors="0" skipped="0" timestamp="2015-06-15T09:30:59+00:00">
passed 38/01
<testsuite name="check role::lamp class check php modules in role::lamp Command &quot;php -m&quot; stdout" tests="1" time="0.001453487" failures="0" errors="0" skipped="0" timestamp="2015-06-15T09:30:59+00:00">
passed 38/01
<testsuite name="check role::lamp class check php modules in role::lamp Command &quot;php -m&quot; stdout" tests="1" time="0.001489803" failures="0" errors="0" skipped="0" timestamp="2015-06-15T09:30:59+00:00">
passed 38/01
<testsuite name="check role::lamp class check php modules in role::lamp Command &quot;php -m&quot; stdout" tests="1" time="0.05774698" failures="0" errors="0" skipped="0" timestamp="2015-06-15T09:30:59+00:00">
passed 38/01
<testsuite name="check role::lamp class check mysql in role::lamp Service &quot;mariadb&quot;" tests="2" time="0.04611685" failures="0" errors="0" skipped="0" timestamp="2015-06-15T09:30:59+00:00">
passed 38/01
<testsuite name="check role::lamp class check php modules in role::lamp Command &quot;php -m&quot; stdout" tests="1" time="0.001483657" failures="0" errors="0" skipped="0" timestamp="2015-06-15T09:30:59+00:00">
passed 38/01
<testsuite name="check role::lamp class check php modules in role::lamp Command &quot;php -m&quot; stdout" tests="1" time="0.001424992" failures="0" errors="0" skipped="0" timestamp="2015-06-15T09:30:59+00:00">
passed 38/01
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-mysql-in-role-lamp.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-php-modules-in-role-lamp-Command-php-m-stdout.0.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-mysql-in-role-lamp-Port-3306-.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-php-modules-in-role-lamp.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-apache-in-role-lamp-Package-httpd-.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-php-modules-in-role-lamp-Command-php-m-.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-php-modules-in-role-lamp-Command-php-m-stdout.12.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-php-modules-in-role-lamp-Command-php-m-stdout.6.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-mysql-in-role-lamp-mon-user-should-be-able-to-login-Command-mysqladmin-umom-PM0n1t0r-2-ping-grep-c-mysqld-is-alive-stdout.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-phpmyadmin-from-outside-in-role-lamp.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-phpmyadmin-dir-in-role-lamp.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-phpmyadmin-dir-in-role-lamp-File-usr-share-phpmyadmin-.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-php-modules-in-role-lamp-Command-php-m-stdout.2.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-php-modules-in-role-lamp-Command-php-m-stdout.10.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-apache-in-role-lamp-Service-httpd-.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-php-modules-in-role-lamp-Command-php-m-stdout.4.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-php-modules-in-role-lamp-Command-php-m-stdout.1.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-apache-in-role-lamp.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-phpmyadmin-from-outside-in-role-lamp-Command-curl-I-k-https-centos-7-role-lamp-lxc-07-ashish-stdout.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-selinux-in-role-lamp-on-Redhat-osfamily.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-phpmyadmin-from-outside-in-role-lamp-Command-curl-I-k-https-centos-7-role-lamp-lxc-07-ashish-.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-selinux-in-role-lamp-on-Redhat-osfamily-SELinux.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-php-modules-in-role-lamp-Command-php-m-stdout.3.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-phpmyadmin-dir-in-role-lamp-File-opt-vhosts-d-25-centos-7-role-lamp-lxc-07-ashish-conf-.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-mysql-in-role-lamp-mon-user-should-be-able-to-login-Command-mysqladmin-umom-PM0n1t0r-2-ping-grep-c-mysqld-is-alive-.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-php-modules-in-role-lamp-Command-php-m-stdout.7.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-apache-in-role-lamp-Port-80-.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-mysql-in-role-lamp-Package-mariadb-server-.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-php-modules-in-role-lamp-Command-php-m-stdout.9.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-apache-in-role-lamp-Port-443-.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-php-modules-in-role-lamp-Command-php-m-stdout.13.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-php-modules-in-role-lamp-Command-php-m-stdout.8.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-mysql-in-role-lamp-mon-user-should-be-able-to-login.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-php-modules-in-role-lamp-Command-php-m-stdout.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-mysql-in-role-lamp-Service-mariadb-.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-php-modules-in-role-lamp-Command-php-m-stdout.5.xml
/var/log/beaker/spec/reports/role::webframeworks::lamp/centos7/latest/SPEC-check-role-lamp-class-check-php-modules-in-role-lamp-Command-php-m-stdout.11.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment