machinery-tool 1.9.1 → 1.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS +7 -0
- data/html/assets/compare/machinery-compare.js +43 -0
- data/html/assets/compare/machinery.js +17 -0
- data/html/assets/machinery.css +13 -0
- data/html/assets/modal.js +280 -0
- data/html/assets/show/machinery-show.js +16 -9
- data/html/assets/show/machinery.js +61 -25
- data/html/comparison.html.haml +194 -116
- data/html/index.html.haml +46 -12
- data/lib/array.rb +2 -1
- data/lib/cli.rb +44 -23
- data/lib/compare_task.rb +5 -29
- data/lib/comparison.rb +69 -0
- data/lib/config.rb +4 -0
- data/lib/export_task.rb +7 -0
- data/lib/file_scope.rb +2 -2
- data/lib/html.rb +165 -88
- data/lib/machinery.rb +6 -2
- data/lib/{generate_html_task.rb → man_task.rb} +8 -6
- data/lib/object.rb +1 -1
- data/lib/renderer.rb +70 -41
- data/lib/{scope_file_access.rb → scope_file_access_archive.rb} +23 -20
- data/lib/scope_file_access_flat.rb +36 -0
- data/lib/serve_html_task.rb +33 -0
- data/lib/show_task.rb +19 -5
- data/lib/system_file.rb +25 -0
- data/lib/version.rb +1 -1
- data/man/generated/machinery.1.gz +0 -0
- data/man/generated/machinery.1.html +60 -34
- data/plugins/changed_managed_files/changed_managed_files_renderer.rb +5 -5
- data/plugins/config_files/config_files_renderer.rb +7 -6
- data/plugins/groups/groups_renderer.rb +3 -3
- data/plugins/os/os_renderer.rb +5 -5
- data/plugins/packages/packages_model.rb +25 -0
- data/plugins/packages/packages_renderer.rb +36 -5
- data/plugins/patterns/patterns_renderer.rb +3 -3
- data/plugins/repositories/repositories_model.rb +1 -1
- data/plugins/repositories/repositories_renderer.rb +4 -4
- data/plugins/services/services_model.rb +2 -2
- data/plugins/services/services_renderer.rb +3 -3
- data/plugins/unmanaged_files/unmanaged_files_model.rb +2 -1
- data/plugins/unmanaged_files/unmanaged_files_renderer.rb +5 -5
- data/plugins/users/users_renderer.rb +3 -3
- metadata +36 -4
@@ -65,10 +65,11 @@
|
|
65
65
|
<a href="#deploy-Deploy-Image-to-OpenStack-Cloud">deploy — Deploy Image to OpenStack Cloud</a>
|
66
66
|
<a href="#export-autoyast-Export-System-Description-as-AutoYasST-profile">export-autoyast — Export System Description as AutoYasST profile</a>
|
67
67
|
<a href="#export-kiwi-Export-System-Description-as-KIWI-Image-Description">export-kiwi — Export System Description as KIWI Image Description</a>
|
68
|
-
<a href="#generate-html-Generate-an-HTML-view-of-a-System-Description">generate-html — Generate an HTML view of a System Description</a>
|
69
68
|
<a href="#inspect-Inspect-Running-System">inspect — Inspect Running System</a>
|
70
69
|
<a href="#list-List-System-Descriptions">list — List System Descriptions</a>
|
70
|
+
<a href="#man-Shows-Man-Page">man — Shows Man Page</a>
|
71
71
|
<a href="#remove-Remove-System-Descriptions">remove — Remove System Descriptions</a>
|
72
|
+
<a href="#serve-Serve-A-System-Description-Using-A-Web-Server">serve — Serve A System Description Using A Web Server</a>
|
72
73
|
<a href="#show-Show-System-Description">show — Show System Description</a>
|
73
74
|
<a href="#upgrade-format-Upgrade-System-Description">upgrade-format — Upgrade System Description</a>
|
74
75
|
<a href="#validate-Validate-System-Description">validate — Validate System Description</a>
|
@@ -777,36 +778,6 @@ will be created if it does not exist yet.</p></dd>
|
|
777
778
|
</dl>
|
778
779
|
|
779
780
|
|
780
|
-
<h2 id="generate-html-Generate-an-HTML-view-of-a-System-Description">generate-html — Generate an HTML view of a System Description</h2>
|
781
|
-
|
782
|
-
<h3 id="SYNOPSIS">SYNOPSIS</h3>
|
783
|
-
|
784
|
-
<p><code>machinery generate-html</code> NAME</p>
|
785
|
-
|
786
|
-
<p><code>machinery</code> help generate-html</p>
|
787
|
-
|
788
|
-
<h3 id="DESCRIPTION">DESCRIPTION</h3>
|
789
|
-
|
790
|
-
<p>The <code>generate-html</code> generates an HTML view of a system description. The
|
791
|
-
index.html file can be found in the according system description directory, e.g.
|
792
|
-
~/.machinery/NAME/index.html.</p>
|
793
|
-
|
794
|
-
<h3 id="ARGUMENTS">ARGUMENTS</h3>
|
795
|
-
|
796
|
-
<dl>
|
797
|
-
<dt><code>NAME</code> (required)</dt><dd>Name of the system description.</dd>
|
798
|
-
</dl>
|
799
|
-
|
800
|
-
|
801
|
-
<h3 id="EXAMPLES">EXAMPLES</h3>
|
802
|
-
|
803
|
-
<dl>
|
804
|
-
<dt>Create an HTML view of the <code>moon</code> system description:</dt><dd><p></p>
|
805
|
-
|
806
|
-
<p>$ <code>machinery</code> generate-html moon</p></dd>
|
807
|
-
</dl>
|
808
|
-
|
809
|
-
|
810
781
|
<h2 id="inspect-Inspect-Running-System">inspect — Inspect Running System</h2>
|
811
782
|
|
812
783
|
<h3 id="SYNOPSIS">SYNOPSIS</h3>
|
@@ -958,6 +929,16 @@ Currently displays [HOSTNAME] and (DATE).</dd>
|
|
958
929
|
</dl>
|
959
930
|
|
960
931
|
|
932
|
+
<h2 id="man-Shows-Man-Page">man — Shows Man Page</h2>
|
933
|
+
|
934
|
+
<h3 id="SYNOPSIS">SYNOPSIS</h3>
|
935
|
+
|
936
|
+
<p> <code>machinery man</code></p>
|
937
|
+
|
938
|
+
<h3 id="DESCRIPTION">DESCRIPTION</h3>
|
939
|
+
|
940
|
+
<p>The <code>man</code> command shows the Machinery man page.</p>
|
941
|
+
|
961
942
|
<h2 id="remove-Remove-System-Descriptions">remove — Remove System Descriptions</h2>
|
962
943
|
|
963
944
|
<h3 id="SYNOPSIS">SYNOPSIS</h3>
|
@@ -1001,11 +982,53 @@ Currently displays [HOSTNAME] and (DATE).</dd>
|
|
1001
982
|
</dl>
|
1002
983
|
|
1003
984
|
|
985
|
+
<h2 id="serve-Serve-A-System-Description-Using-A-Web-Server">serve — Serve A System Description Using A Web Server</h2>
|
986
|
+
|
987
|
+
<h3 id="SYNOPSIS">SYNOPSIS</h3>
|
988
|
+
|
989
|
+
<p><code>machinery serve</code> [-p PORT | --port=PORT] [-i IP | --ip=IP] NAME</p>
|
990
|
+
|
991
|
+
<p><code>machinery</code> help serve</p>
|
992
|
+
|
993
|
+
<h3 id="DESCRIPTION">DESCRIPTION</h3>
|
994
|
+
|
995
|
+
<p>The <code>serve</code> command spawns a web server and serves a stored system description on
|
996
|
+
it.
|
997
|
+
By default the description is available from http://127.0.0.1:7585 but both the
|
998
|
+
IP address and the port can be configured using the according options.</p>
|
999
|
+
|
1000
|
+
<h3 id="ARGUMENTS">ARGUMENTS</h3>
|
1001
|
+
|
1002
|
+
<dl>
|
1003
|
+
<dt><code>NAME</code> (required)</dt><dd>Use specified system description.</dd>
|
1004
|
+
</dl>
|
1005
|
+
|
1006
|
+
|
1007
|
+
<h3 id="OPTIONS">OPTIONS</h3>
|
1008
|
+
|
1009
|
+
<dl>
|
1010
|
+
<dt><code>-p PORT</code>, <code>--port=PORT</code> (optional)</dt><dd><p>Specify the port on which the web server will serve the system description: Default: 7585</p></dd>
|
1011
|
+
<dt><code>-i IP</code>, <code>--ip=IP</code> (optional)</dt><dd><p>Specify the IP address on which the web server will be made available. Default: 127.0.0.1</p></dd>
|
1012
|
+
</dl>
|
1013
|
+
|
1014
|
+
|
1015
|
+
<h3 id="EXAMPLES">EXAMPLES</h3>
|
1016
|
+
|
1017
|
+
<dl>
|
1018
|
+
<dt>Serve the system description taken from the last inspection, saved as <code>earth</code>:</dt><dd><p></p>
|
1019
|
+
|
1020
|
+
<p>$ <code>machinery</code> serve earth</p></dd>
|
1021
|
+
<dt>Make the system description available to other machines on the network:</dt><dd><p></p>
|
1022
|
+
|
1023
|
+
<p>$ <code>machinery</code> serve earth -i 10.10.100.123 -p 3000</p></dd>
|
1024
|
+
</dl>
|
1025
|
+
|
1026
|
+
|
1004
1027
|
<h2 id="show-Show-System-Description">show — Show System Description</h2>
|
1005
1028
|
|
1006
1029
|
<h3 id="SYNOPSIS">SYNOPSIS</h3>
|
1007
1030
|
|
1008
|
-
<p><code>machinery show</code> [-s SCOPE | --scope=SCOPE] [-e EXCLUDE-SCOPE | --exclude-scope=EXCLUDE-SCOPE] [--no-pager] [--show-diffs] [--html] NAME</p>
|
1031
|
+
<p><code>machinery show</code> [-s SCOPE | --scope=SCOPE] [-e EXCLUDE-SCOPE | --exclude-scope=EXCLUDE-SCOPE] [--no-pager] [--show-diffs] [--html] [-p PORT | --port=PORT] [-i IP | --ip=IP] NAME</p>
|
1009
1032
|
|
1010
1033
|
<p><code>machinery</code> help show</p>
|
1011
1034
|
|
@@ -1035,7 +1058,10 @@ See the <a href="#Scopes" data-bare-link="true">Scope section</a> for more infor
|
|
1035
1058
|
<dt><code>--no-pager</code> (optional)</dt><dd><p>Do not pipe output into a pager.</p></dd>
|
1036
1059
|
<dt><code>--show-diffs</code> (optional)</dt><dd><p>Include the generated diffs in the output if available (see <code>machinery help analyze</code>
|
1037
1060
|
for more information).</p></dd>
|
1038
|
-
<dt><code>--html</code> (optional)</dt><dd><p>
|
1061
|
+
<dt><code>--html</code> (optional)</dt><dd><p>Run a web server and open the system description in HTML format in your web browser using the
|
1062
|
+
<code>xdg-open</code> command.</p></dd>
|
1063
|
+
<dt><code>-p PORT</code>, <code>--port=PORT</code> (optional)</dt><dd><p>Specify the port on which the web server will serve the system description: Default: 7585</p></dd>
|
1064
|
+
<dt><code>-i IP</code>, <code>--ip=IP</code> (optional)</dt><dd><p>Specify the IP address on which the web server will be made available. Default: 127.0.0.1</p></dd>
|
1039
1065
|
<dt><code>--verbose</code> (optional)</dt><dd><p>Display the filters which were applied before showing the system description.</p></dd>
|
1040
1066
|
</dl>
|
1041
1067
|
|
@@ -1172,7 +1198,7 @@ manually editing it.</p>
|
|
1172
1198
|
|
1173
1199
|
<ol class='man-decor man-foot man foot'>
|
1174
1200
|
<li class='tl'></li>
|
1175
|
-
<li class='tc'>
|
1201
|
+
<li class='tc'>July 2015</li>
|
1176
1202
|
<li class='tr'>machinery(1)</li>
|
1177
1203
|
</ol>
|
1178
1204
|
|
@@ -16,17 +16,17 @@
|
|
16
16
|
# you may find current contact information at www.suse.com
|
17
17
|
|
18
18
|
class ChangedManagedFilesRenderer < Renderer
|
19
|
-
def
|
20
|
-
return unless
|
19
|
+
def content(description)
|
20
|
+
return unless description["changed_managed_files"]
|
21
21
|
|
22
|
-
if
|
23
|
-
files, errors =
|
22
|
+
if description["changed_managed_files"].files
|
23
|
+
files, errors = description["changed_managed_files"].files.partition do |file|
|
24
24
|
file.status != "error"
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
list do
|
29
|
-
file_status =
|
29
|
+
file_status = description["changed_managed_files"].extracted
|
30
30
|
if !file_status.nil?
|
31
31
|
puts "Files extracted: #{file_status ? "yes" : "no"}"
|
32
32
|
end
|
@@ -16,24 +16,25 @@
|
|
16
16
|
# you may find current contact information at www.suse.com
|
17
17
|
|
18
18
|
class ConfigFilesRenderer < Renderer
|
19
|
-
def
|
20
|
-
return unless
|
19
|
+
def content(description)
|
20
|
+
return unless description["config_files"]
|
21
21
|
|
22
|
-
diffs_dir =
|
22
|
+
diffs_dir = description.scope_file_store("analyze/config_file_diffs").path
|
23
23
|
|
24
24
|
if !diffs_dir && @options[:show_diffs]
|
25
25
|
raise Machinery::Errors::SystemDescriptionError.new(
|
26
26
|
"Diffs can not be shown because they were not generated yet.\n" \
|
27
|
-
"You can generate them with `#{$0} analyze
|
27
|
+
"You can generate them with `#{$0} analyze" \
|
28
|
+
" --operation=config-file-diffs #{description.name}`."
|
28
29
|
)
|
29
30
|
end
|
30
31
|
|
31
32
|
list do
|
32
|
-
file_status =
|
33
|
+
file_status = description["config_files"].extracted
|
33
34
|
if !file_status.nil?
|
34
35
|
puts "Files extracted: #{file_status ? "yes" : "no"}"
|
35
36
|
end
|
36
|
-
files =
|
37
|
+
files = description["config_files"].files
|
37
38
|
if files
|
38
39
|
files.each do |p|
|
39
40
|
item_content = "#{p.name} (#{p.package_name}-#{p.package_version}, " \
|
@@ -16,11 +16,11 @@
|
|
16
16
|
# you may find current contact information at www.suse.com
|
17
17
|
|
18
18
|
class GroupsRenderer < Renderer
|
19
|
-
def
|
20
|
-
return unless
|
19
|
+
def content(description)
|
20
|
+
return unless description.groups
|
21
21
|
|
22
22
|
list do
|
23
|
-
|
23
|
+
description.groups.each do |group|
|
24
24
|
gid = group.gid || "N/A"
|
25
25
|
details ="gid: #{gid}"
|
26
26
|
details += ", users: #{group.users.join(",")}" if !group.users.empty?
|
data/plugins/os/os_renderer.rb
CHANGED
@@ -17,12 +17,12 @@
|
|
17
17
|
|
18
18
|
# This renderer prints the operating system
|
19
19
|
class OsRenderer < Renderer
|
20
|
-
def
|
21
|
-
return unless
|
20
|
+
def content(description)
|
21
|
+
return unless description.os
|
22
22
|
|
23
|
-
puts "Name: #{
|
24
|
-
puts "Version: #{
|
25
|
-
puts "Architecture: #{
|
23
|
+
puts "Name: #{description.os.name}"
|
24
|
+
puts "Version: #{description.os.version}"
|
25
|
+
puts "Architecture: #{description.os.architecture}"
|
26
26
|
end
|
27
27
|
|
28
28
|
def display_name
|
@@ -23,4 +23,29 @@ class PackagesScope < Machinery::Array
|
|
23
23
|
include Machinery::Scope
|
24
24
|
|
25
25
|
has_elements class: Package
|
26
|
+
|
27
|
+
def compare_with(other)
|
28
|
+
only_self = self - other
|
29
|
+
only_other = other - self
|
30
|
+
common = self & other
|
31
|
+
|
32
|
+
changed_package_names = only_self.map(&:name) & only_other.map(&:name)
|
33
|
+
changed = []
|
34
|
+
|
35
|
+
changed_package_names.each do |name|
|
36
|
+
changed << [
|
37
|
+
only_self.find { |package| package.name == name },
|
38
|
+
only_other.find { |package| package.name == name },
|
39
|
+
]
|
40
|
+
only_self.reject! { |package| package.name == name }
|
41
|
+
only_other.reject! { |package| package.name == name }
|
42
|
+
end
|
43
|
+
|
44
|
+
[
|
45
|
+
only_self,
|
46
|
+
only_other,
|
47
|
+
changed,
|
48
|
+
common
|
49
|
+
].map { |e| (e && !e.empty?) ? e : nil }
|
50
|
+
end
|
26
51
|
end
|
@@ -16,17 +16,48 @@
|
|
16
16
|
# you may find current contact information at www.suse.com
|
17
17
|
|
18
18
|
class PackagesRenderer < Renderer
|
19
|
-
def
|
20
|
-
|
19
|
+
def display_name
|
20
|
+
"Packages"
|
21
|
+
end
|
22
|
+
|
23
|
+
def content(description)
|
24
|
+
return unless description.packages
|
21
25
|
|
22
26
|
list do
|
23
|
-
|
27
|
+
description.packages.each do |p|
|
24
28
|
item "#{p.name}-#{p.version}-#{p.release}.#{p.arch} (#{p.vendor})"
|
25
29
|
end
|
26
30
|
end
|
27
31
|
end
|
28
32
|
|
29
|
-
|
30
|
-
|
33
|
+
# In the comparison case we only want to show the package name, not all details like version,
|
34
|
+
# architecture etc.
|
35
|
+
def compare_content_only_in(description)
|
36
|
+
list do
|
37
|
+
description.packages.each do |p|
|
38
|
+
item "#{p.name}"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def compare_content_changed(changed_elements)
|
44
|
+
list do
|
45
|
+
changed_elements.each do |one, two|
|
46
|
+
changes = []
|
47
|
+
relevant_attributes = ["version", "vendor", "arch"]
|
48
|
+
if one.version == two.version
|
49
|
+
relevant_attributes << "release"
|
50
|
+
relevant_attributes << "checksum" if one.release == two.release
|
51
|
+
end
|
52
|
+
|
53
|
+
relevant_attributes.each do |attribute|
|
54
|
+
if one[attribute] != two[attribute]
|
55
|
+
changes << "#{attribute}: #{one[attribute]} <> #{two[attribute]}"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
item "#{one.name} (#{changes.join(", ")})"
|
60
|
+
end
|
61
|
+
end
|
31
62
|
end
|
32
63
|
end
|
@@ -16,11 +16,11 @@
|
|
16
16
|
# you may find current contact information at www.suse.com
|
17
17
|
|
18
18
|
class PatternsRenderer < Renderer
|
19
|
-
def
|
20
|
-
return unless
|
19
|
+
def content(description)
|
20
|
+
return unless description.patterns
|
21
21
|
|
22
22
|
list do
|
23
|
-
|
23
|
+
description.patterns.each do |p|
|
24
24
|
item "#{p.name}"
|
25
25
|
end
|
26
26
|
end
|
@@ -16,15 +16,15 @@
|
|
16
16
|
# you may find current contact information at www.suse.com
|
17
17
|
|
18
18
|
class RepositoriesRenderer < Renderer
|
19
|
-
def
|
20
|
-
return unless
|
19
|
+
def content(description)
|
20
|
+
return unless description.repositories
|
21
21
|
|
22
|
-
if
|
22
|
+
if description.repositories.empty?
|
23
23
|
puts "System has no repositories"
|
24
24
|
end
|
25
25
|
|
26
26
|
list do
|
27
|
-
|
27
|
+
description.repositories.each do |p|
|
28
28
|
item "#{p.name}" do
|
29
29
|
puts "URI: #{p.url}"
|
30
30
|
puts "Alias: #{p.alias}"
|
@@ -38,11 +38,12 @@ class ServicesScope < Machinery::Object
|
|
38
38
|
|
39
39
|
def compare_with(other)
|
40
40
|
if self.init_system != other.init_system
|
41
|
-
[self, other, nil]
|
41
|
+
[self, other, nil, nil]
|
42
42
|
else
|
43
43
|
[
|
44
44
|
self.services - other.services,
|
45
45
|
other.services - self.services,
|
46
|
+
[],
|
46
47
|
self.services & other.services
|
47
48
|
].map do |services|
|
48
49
|
if !services.empty?
|
@@ -54,4 +55,3 @@ class ServicesScope < Machinery::Object
|
|
54
55
|
end
|
55
56
|
end
|
56
57
|
end
|
57
|
-
|
@@ -16,11 +16,11 @@
|
|
16
16
|
# you may find current contact information at www.suse.com
|
17
17
|
|
18
18
|
class ServicesRenderer < Renderer
|
19
|
-
def
|
20
|
-
return unless
|
19
|
+
def content(description)
|
20
|
+
return unless description["services"]
|
21
21
|
|
22
22
|
list do
|
23
|
-
|
23
|
+
description["services"].services.each do |p|
|
24
24
|
item "#{p.name}: #{p.state}"
|
25
25
|
end
|
26
26
|
end
|
@@ -16,17 +16,17 @@
|
|
16
16
|
# you may find current contact information at www.suse.com
|
17
17
|
|
18
18
|
class UnmanagedFilesRenderer < Renderer
|
19
|
-
def
|
20
|
-
return unless
|
19
|
+
def content(description)
|
20
|
+
return unless description["unmanaged_files"]
|
21
21
|
|
22
22
|
list do
|
23
|
-
file_status =
|
23
|
+
file_status = description["unmanaged_files"].extracted
|
24
24
|
if !file_status.nil?
|
25
25
|
puts "Files extracted: #{file_status ? "yes" : "no"}"
|
26
26
|
end
|
27
27
|
|
28
|
-
if
|
29
|
-
|
28
|
+
if description["unmanaged_files"].files
|
29
|
+
description["unmanaged_files"].files.each do |p|
|
30
30
|
if p.user && p.group
|
31
31
|
item "#{p.name} (#{p.type})" do
|
32
32
|
puts "User/Group: #{p.user}:#{p.group}"
|
@@ -16,11 +16,11 @@
|
|
16
16
|
# you may find current contact information at www.suse.com
|
17
17
|
|
18
18
|
class UsersRenderer < Renderer
|
19
|
-
def
|
20
|
-
return unless
|
19
|
+
def content(description)
|
20
|
+
return unless description.users
|
21
21
|
|
22
22
|
list do
|
23
|
-
|
23
|
+
description.users.each do |user|
|
24
24
|
info = user.comment.empty? ? "N/A" : user.comment
|
25
25
|
uid = user.uid || "N/A"
|
26
26
|
gid = user.gid || "N/A"
|