machinery-tool 1.21.0 → 1.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/.git_revision +1 -1
  3. data/NEWS +8 -0
  4. data/html/index.html.haml +8 -7
  5. data/html/partials/changed_config_files.html.haml +1 -1
  6. data/html/partials/changed_managed_files.html.haml +1 -1
  7. data/html/partials/unmanaged_files.html.haml +2 -2
  8. data/lib/cli.rb +26 -4
  9. data/lib/diff_widget.rb +73 -0
  10. data/lib/dpkg_database.rb +16 -1
  11. data/lib/haml_helpers.rb +60 -0
  12. data/lib/kiwi_config.rb +7 -0
  13. data/lib/machinery.rb +3 -0
  14. data/lib/man_task.rb +3 -2
  15. data/lib/move_task.rb +1 -0
  16. data/lib/remote_system.rb +4 -0
  17. data/lib/server.rb +2 -105
  18. data/lib/static_html.rb +75 -0
  19. data/lib/system.rb +2 -1
  20. data/lib/system_description.rb +10 -0
  21. data/lib/version.rb +1 -1
  22. data/machinery-helper/version.go +1 -1
  23. data/man/generated/machinery.1.gz +0 -0
  24. data/manual/docs/README.md +8 -16
  25. data/manual/docs/docs.md +42 -4
  26. data/manual/docs/index.html +6 -2
  27. data/manual/docs/machinery-analyze.1.md +6 -10
  28. data/manual/docs/machinery-build.1.md +7 -11
  29. data/manual/docs/machinery-compare.1.md +5 -10
  30. data/manual/docs/machinery-config.1.md +4 -7
  31. data/manual/docs/machinery-copy.1.md +5 -10
  32. data/manual/docs/machinery-deploy.1.md +8 -12
  33. data/manual/docs/machinery-export-autoyast.1.md +10 -17
  34. data/manual/docs/machinery-export-html.1.md +32 -0
  35. data/manual/docs/machinery-export-kiwi.1.md +7 -12
  36. data/manual/docs/{machinery-inspect-docker.1.md → machinery-inspect-container.1.md} +10 -15
  37. data/manual/docs/machinery-inspect.1.md +10 -15
  38. data/manual/docs/machinery-list.1.md +4 -8
  39. data/manual/docs/machinery-man.1.md +4 -6
  40. data/manual/docs/machinery-move.1.md +4 -8
  41. data/manual/docs/machinery-remove.1.md +5 -10
  42. data/manual/docs/machinery-serve.1.md +5 -9
  43. data/manual/docs/machinery-show.1.md +7 -11
  44. data/manual/docs/machinery-upgrade-format.1.md +5 -9
  45. data/manual/docs/machinery-validate.1.md +4 -8
  46. data/manual/docs/machinery_main_general.1.md +33 -51
  47. data/manual/docs/machinery_main_scopes.1.md +13 -14
  48. data/manual/docs/{machinery_security_implications.1.md → machinery_main_security_implications.1.md} +15 -15
  49. data/manual/docs/machinery_main_usecases.1.md +2 -30
  50. data/manual/mkdocs.yml +9 -9
  51. data/manual/site/docs/index.html +71 -25
  52. data/manual/site/index.html +6 -2
  53. data/manual/site/machinery-analyze.1/index.html +34 -27
  54. data/manual/site/machinery-build.1/index.html +35 -28
  55. data/manual/site/machinery-compare.1/index.html +33 -26
  56. data/manual/site/machinery-config.1/index.html +32 -25
  57. data/manual/site/machinery-copy.1/index.html +33 -27
  58. data/manual/site/machinery-deploy.1/index.html +36 -29
  59. data/manual/site/machinery-export-autoyast.1/index.html +38 -32
  60. data/manual/site/machinery-export-html.1/index.html +175 -0
  61. data/manual/site/machinery-export-kiwi.1/index.html +35 -28
  62. data/manual/site/machinery-inspect-container.1/index.html +249 -0
  63. data/manual/site/machinery-inspect.1/index.html +38 -31
  64. data/manual/site/machinery-list.1/index.html +32 -25
  65. data/manual/site/machinery-man.1/index.html +32 -26
  66. data/manual/site/machinery-move.1/index.html +32 -25
  67. data/manual/site/machinery-remove.1/index.html +33 -26
  68. data/manual/site/machinery-serve.1/index.html +33 -26
  69. data/manual/site/machinery-show.1/index.html +35 -28
  70. data/manual/site/machinery-upgrade-format.1/index.html +33 -26
  71. data/manual/site/machinery-validate.1/index.html +32 -25
  72. data/manual/site/machinery_main_general.1/index.html +63 -70
  73. data/manual/site/machinery_main_scopes.1/index.html +41 -36
  74. data/manual/site/machinery_main_security_implications.1/index.html +228 -0
  75. data/manual/site/machinery_main_usecases.1/index.html +30 -48
  76. data/manual/site/mkdocs/search_index.json +246 -201
  77. data/manual/site/sitemap.xml +40 -30
  78. data/plugins/os/os_inspector.rb +1 -1
  79. data/plugins/packages/packages.yml +1 -1
  80. data/plugins/patterns/patterns.yml +2 -5
  81. data/plugins/repositories/repositories.yml +2 -2
  82. data/plugins/unmanaged_files/unmanaged_files.yml +3 -3
  83. data/plugins/unmanaged_files/unmanaged_files_renderer.rb +1 -1
  84. metadata +11 -5
  85. data/manual/docs/subcommand-template.1.md +0 -46
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+ # Copyright (c) 2013-2016 SUSE LLC
3
+ #
4
+ # This program is free software; you can redistribute it and/or
5
+ # modify it under the terms of version 3 of the GNU General Public License as
6
+ # published by the Free Software Foundation.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program; if not, contact SUSE LLC.
15
+ #
16
+ # To contact SUSE about this file by physical or electronic mail,
17
+ # you may find current contact information at www.suse.com
18
+ class StaticHtml < Exporter
19
+ TEMPLATE_DIR = File.join(Machinery::ROOT, "html").freeze
20
+ PARTIAL_DIR = File.join(Machinery::ROOT, "html", "partials").freeze
21
+
22
+ include HamlHelpers
23
+
24
+ def initialize(description, directory)
25
+ @description = description
26
+ @directory = directory
27
+ @static_html = true
28
+ end
29
+ attr_reader :description
30
+
31
+ def haml(source, options = {})
32
+ Haml::Engine.new(source).render(binding, options.delete(:locals))
33
+ end
34
+
35
+ def write
36
+ @description.load_existing_diffs
37
+ render_html
38
+ copy_assets
39
+ end
40
+
41
+ def create_directory(force = false)
42
+ if File.exist?(@directory)
43
+ if force
44
+ FileUtils.rm_r(@directory)
45
+ else
46
+ raise Machinery::Errors::ExportFailed.new(
47
+ "The output directory '#{@directory}' already exists." \
48
+ " You can force overwriting it with the '--force' option."
49
+ )
50
+ end
51
+ end
52
+ FileUtils.mkdir_p(@directory)
53
+ end
54
+
55
+ private
56
+
57
+ def copy_assets
58
+ FileUtils.cp_r(File.join(TEMPLATE_DIR, "assets"), @directory)
59
+ FileUtils.rm_r(File.join(@directory, "assets", "compare"))
60
+ end
61
+
62
+ def render_html
63
+ File.open(File.join(@directory, "index.html"), "w") do |f|
64
+ f.puts Haml::Engine.new(static_index_path).render(self, description: @description)
65
+ end
66
+ end
67
+
68
+ def static_index_path
69
+ File.read(File.join(TEMPLATE_DIR, "index.html.haml"))
70
+ end
71
+
72
+ def partial_path(partial)
73
+ File.read(File.join(PARTIAL_DIR, "#{partial}.html.haml"))
74
+ end
75
+ end
data/lib/system.rb CHANGED
@@ -76,8 +76,9 @@ class System
76
76
  out = File.open(archive, "w")
77
77
  begin
78
78
  run_command(
79
- "tar", "--create", "--gzip", "--null", "--files-from=-",
79
+ "tar", "--create", "--gzip",
80
80
  *exclude.flat_map { |f| ["--exclude", f]},
81
+ "--null", "--files-from=-",
81
82
  stdout: out,
82
83
  stdin: Array(file_list).join("\0"),
83
84
  privileged: true,
@@ -310,6 +310,16 @@ class SystemDescription < Machinery::Object
310
310
  end
311
311
  end
312
312
 
313
+ # Enrich description with the config file diffs
314
+ def load_existing_diffs
315
+ diffs_dir = scope_file_store("analyze/changed_config_files_diffs").path
316
+ return unless changed_config_files && diffs_dir
317
+ changed_config_files.each do |file|
318
+ path = File.join(diffs_dir, file.name + ".diff")
319
+ file.diff = DiffWidget.new(File.read(path)).widget if File.exist?(path)
320
+ end
321
+ end
322
+
313
323
  private
314
324
 
315
325
  def parse_variable_assignment(string, variable)
data/lib/version.rb CHANGED
@@ -17,6 +17,6 @@
17
17
 
18
18
  module Machinery
19
19
 
20
- VERSION = "1.21.0"
20
+ VERSION = "1.22.0"
21
21
 
22
22
  end
@@ -2,4 +2,4 @@
2
2
 
3
3
  package main
4
4
 
5
- const VERSION = "cf6d038ddefdf0d539b132c206336e141c39b418"
5
+ const VERSION = "964505b0908b5f767f7fb74053b19884ae2e0954"
Binary file
@@ -4,13 +4,11 @@ This guide provides answers to writing and style questions commonly arising when
4
4
  documentation.
5
5
  The following rules are intentionally kept concise. Refer to our [SUSE Styleguide][1] for more information.
6
6
 
7
-
8
7
  ## Audience
9
8
 
10
9
  Our main audience for the documentation are system administrators. Adjust tone, style, and
11
10
  technicality of the text based on the intended audience.
12
11
 
13
-
14
12
  ## Physical Structure
15
13
 
16
14
  The documentation is written in Markdown and contains:
@@ -22,10 +20,8 @@ The documentation is written in Markdown and contains:
22
20
 
23
21
  * Scopes are described in the `documentation` attribute in `plugins/SCOPENAME/SCOPENAME.yml`
24
22
 
25
-
26
- **Tip:** To create a file for your subcommand, copy the `subcommand-template.1.md` template to
27
- `machinery-SUBCOMMAND.1.md` and edit the latter.
28
-
23
+ **Tip:** To create a file for your subcommand, copy an existing one to
24
+ `machinery-SUBCOMMAND.1.md` and edit the latter according to the following "Logical Structure".
29
25
 
30
26
  ## Logical Structure
31
27
 
@@ -37,18 +33,18 @@ The structure of each subcommand contains:
37
33
 
38
34
  ## SUBCOMMAND—Short Description
39
35
 
40
- * a section "SYNOPSIS"
36
+ * a section "Synopsis"
41
37
 
42
38
  Contains the output of `machinery SUBCOMMAND --help` or `machinery help SUBCOMMAND`.
43
39
  Use square brackets for options which are optional.
44
40
 
45
- * a section "DESCRIPTION"
41
+ * a section "Description"
46
42
 
47
43
  Summarize the purpose of the subcommand in a short, first paragraph. Leave an
48
44
  empty line, and then describe what the command does, what its output is, and
49
45
  which interaction may be needed.
50
46
 
51
- * a section "OPTIONS"
47
+ * a section "Options"
52
48
 
53
49
  List all options. Use a separate list item for each option and wrap short and
54
50
  long option name in back ticks. State if the option is mandatory or optional
@@ -59,17 +55,17 @@ The structure of each subcommand contains:
59
55
 
60
56
  Capitalize any placeholders.
61
57
 
62
- * a section "PREREQUISITES"
58
+ * a section "Prerequisites"
63
59
 
64
60
  List all the necessary topics, items, or other conditions that the user have
65
61
  to be fulfilled beforehand the subcommand can be executed.
66
62
 
67
- * a section "DEPENDENCIES"
63
+ * a section "Dependencies"
68
64
 
69
65
  List only those dependencies which cannot be expressed as package dependencies.
70
66
  Package dependencies are automatically resolved when the `machinery` package is installed.
71
67
 
72
- * a section "EXAMPLES"
68
+ * a section "Examples"
73
69
 
74
70
  Provide at least two meaningful examples of how to use the subcommand.
75
71
  Start with the most common or easy one and explain what it does. Include also a more unusual or difficult
@@ -79,7 +75,6 @@ The structure of each subcommand contains:
79
75
 
80
76
  machinery SUBCOMMAND --opt1 ...
81
77
 
82
-
83
78
  ## Level of Detail
84
79
 
85
80
  The Machinery documentation is mainly a reference: an overview of Machinery itself, its
@@ -92,7 +87,6 @@ For example, it is unimportant whether a subcommand uses `rpm`, `zypper`, or any
92
87
  to retrieve a package list. In that case, it is enough to mention that Machinery gets this list
93
88
  somehow and focus on what it does with this information.
94
89
 
95
-
96
90
  ## Language
97
91
 
98
92
  For language and spelling rules, refer to our [SUSE Styleguide, section "Language"][1] which covers most of your
@@ -100,7 +94,6 @@ questions already.
100
94
 
101
95
  If you are unsure about spelling, go to the [Merriam Webster][20] homepage or consult our [SUSE Terminology][3].
102
96
 
103
-
104
97
  ## Consistency Hints
105
98
 
106
99
  * Be consistent. For example, if you explain the `--name` option and start your description with a verb,
@@ -118,7 +111,6 @@ If you are unsure about spelling, go to the [Merriam Webster][20] homepage or co
118
111
 
119
112
  * Capitalize placeholders, for example, `machinery show NAME`.
120
113
 
121
-
122
114
  [1]: http://doc.opensuse.org/products/opensuse/Styleguide/opensuse_documentation_styleguide_sd/#sec.language "SUSE Styleguide: Language"
123
115
  [2]: http://doc.opensuse.org/products/opensuse/Styleguide/opensuse_documentation_styleguide_sd/#sec.capitalization "SUSE Styleguide: Capitalization and Title Style"
124
116
  [3]: http://doc.opensuse.org/products/opensuse/Styleguide/opensuse_documentation_styleguide_sd/#sec.terminology "SUSE Styleguide: Terminology"
data/manual/docs/docs.md CHANGED
@@ -1,7 +1,45 @@
1
1
  # Machinery Documentation
2
2
 
3
- This is the documentation of Machinery.
3
+ Welcome! The Machinary documentation is a reference aimed at system administrators.
4
+ It will give you an overview of Machinery itself, its subcommands, and usage examples.
4
5
 
5
- * [Overview](machinery_main_general.1/)
6
- * [Scopes](machinery_main_scopes.1/)
7
- * [Use cases](machinery_main_usecases.1/)
6
+ # What is Machinery?
7
+
8
+ Machinery is a systems management toolkit for Linux. It supports configuration
9
+ discovery, system validation, and service migration. Machinery is based on the
10
+ idea of a universal system description. Machinery has a set of commands which
11
+ work with this system description. These commands can be combined to form work
12
+ flows. Machinery is targeted at the system administrator of the data center.
13
+
14
+ # Work Flow Examples
15
+
16
+ ## Inspect a System and Show Results
17
+ - `machinery inspect --extract-files --name=NAME HOSTNAME`
18
+ - `machinery show NAME`
19
+
20
+ ## Export System Description as HTML
21
+
22
+ - `machinery export-html --html-dir=tmp NAME`
23
+
24
+ ## Inspect Two Systems and Compare Them
25
+ - `machinery inspect HOSTNAME1`
26
+ - `machinery inspect HOSTNAME2`
27
+ - `machinery compare HOSTNAME1 HOSTNAME2`
28
+
29
+ ## Fully Inspect a System and Export a Kiwi Description
30
+ - `machinery inspect --extract-files HOSTNAME`
31
+ - `machinery export-kiwi --kiwi-dir=~/kiwi HOSTNAME`
32
+
33
+ ## Fully Inspect a System and Export an AutoYaST Profile
34
+ - `machinery inspect --extract-files HOSTNAME`
35
+ - `machinery export-autoyast --autoyast-dir=~/autoyast HOSTNAME`
36
+
37
+ ## Fully Inspect a System and Deploy a Replicate to the Cloud
38
+ - `machinery inspect --extract-files HOSTNAME`
39
+ - `machinery deploy --cloud-config=~/openrc.sh HOSTNAME`
40
+
41
+ ## How to upgrade a SLES 11 SP3 system to SLES 12
42
+ - Machinery can help you to upgrade without affecting the original system.
43
+ For more details please read the Wiki Page: [How to upgrade a SLES 11 SP3 system to SLES 12](https://github.com/SUSE/machinery/wiki/How-to-upgrade-a-SLES-11-SP3-system-to-SLES-12).
44
+
45
+ For a more detailed overview see [General Overview](machinery_main_general.1/).
@@ -72,7 +72,7 @@
72
72
  </div>
73
73
  </div>
74
74
 
75
- <div>
75
+ <div>
76
76
  <div class="git">
77
77
  <a class="btn btn-default" href="{{_base_url_}}docs/">Documentation</a>
78
78
  </div>
@@ -84,7 +84,11 @@
84
84
  </div>
85
85
  </div>
86
86
 
87
-
87
+ <div>
88
+ <div class="git">
89
+ <a class="btn btn-default" href="https://machinery-project.blogspot.de/">Machinery Blog</a>
90
+ </div>
91
+ </div>
88
92
  </div>
89
93
 
90
94
  <div>
@@ -1,36 +1,32 @@
1
1
  # analyze — Analyze System Description
2
2
 
3
- ## SYNOPSIS
3
+ ## Synopsis
4
4
 
5
5
  `machinery analyze` NAME -o | --operation=OPERATION
6
6
 
7
7
  `machinery` help analyze
8
8
 
9
-
10
- ## DESCRIPTION
9
+ ## Description
11
10
 
12
11
  The `analyze` subcommand analyzes an existing system description and enriches
13
12
  it with additional information. Supported operations are:
14
13
 
15
14
  * `changed-config-files-diffs`:
16
15
  Generates the diffs between the extracted changed configuration files from the
17
- system and the original versions from the RPM packages.
16
+ system and the original versions from the packages.
18
17
  The diffs can be shown using `machinery show --show-diffs`
19
18
 
20
-
21
- ## ARGUMENTS
19
+ ## Arguments
22
20
 
23
21
  * `NAME` (required):
24
22
  Name of the system description.
25
23
 
26
-
27
- ## OPTIONS
24
+ ## Options
28
25
 
29
26
  * `-o OPERATION`, `--operation=OPERATION` (required):
30
27
  The analyze operation to perform.
31
28
 
32
-
33
- ## EXAMPLES
29
+ ## Examples
34
30
 
35
31
  * Analyze the config file diffs for the `myhost` system description:
36
32
 
@@ -1,20 +1,19 @@
1
1
  # build — Build Image from System Description
2
2
 
3
- ## SYNOPSIS
3
+ ## Synopsis
4
4
 
5
5
  `machinery build` NAME -i IMAGE-DIR | --image-dir=IMAGE-DIR
6
6
 
7
7
  `machinery` help build
8
8
 
9
-
10
- ## DESCRIPTION
9
+ ## Description
11
10
 
12
11
  The `build` command builds an image from a system description. The image is a
13
12
  system image in the qcow2 format, which can be used with the KVM hypervisor.
14
13
  It can be run locally or deployed to a cloud environment.
15
14
 
16
15
  `machinery` uses the image building command line tool
17
- [KIWI](http://en.opensuse.org/Portal:KIWI) to perform the actual build. KIWI
16
+ [KIWI](http://opensuse.github.io/kiwi/) to perform the actual build. KIWI
18
17
  data is stored to a temporary directory and cleaned up after the build. The KIWI
19
18
  log is shown as output of the `build` command format for showing progress and
20
19
  diagnosing errors.
@@ -22,14 +21,12 @@ diagnosing errors.
22
21
  When building an image, Machinery filters out some files which would break the
23
22
  built image. The list of filters is shown at the beginning of the build.
24
23
 
25
-
26
- ## ARGUMENTS
24
+ ## Arguments
27
25
 
28
26
  * `NAME` (required):
29
27
  Use specified system description.
30
28
 
31
-
32
- ## OPTIONS
29
+ ## Options
33
30
 
34
31
  * `-i IMAGE-DIR`, `--image-dir=IMAGE-DIR` (required):
35
32
  Save image file under specified path.
@@ -40,8 +37,7 @@ built image. The list of filters is shown at the beginning of the build.
40
37
  * `-s`, `--enable-ssh` (optional):
41
38
  Enable SSH service in built image
42
39
 
43
-
44
- ## PREREQUISITES
40
+ ## Prerequisites
45
41
 
46
42
  * The `build` command requires the packages `kiwi` and `kiwi-desc-vmxboot`.
47
43
 
@@ -54,7 +50,7 @@ built image. The list of filters is shown at the beginning of the build.
54
50
 
55
51
  * Machinery can only build x86_64 images on x86_64 systems at the moment.
56
52
 
57
- ## EXAMPLES
53
+ ## Examples
58
54
 
59
55
  * To build an image from the system description named "tux" and to save the
60
56
  image under the `/tmp/tux/` directory:
@@ -1,20 +1,17 @@
1
-
2
1
  # compare — Compare System Descriptions
3
2
 
4
- ## SYNOPSIS
3
+ ## Synopsis
5
4
 
6
5
  `machinery compare` [-s SCOPE | --scope=SCOPE] [-e IGNORE-SCOPE | --ignore-scope=IGNORE-SCOPE] [--no-pager] [--show-all] [--html] NAME1 NAME2
7
6
 
8
7
  `machinery` help compare
9
8
 
10
-
11
- ## DESCRIPTION
9
+ ## Description
12
10
 
13
11
  The `compare` command compares stored system descriptions. The scope option can
14
12
  be used to limit the output to the given scopes.
15
13
 
16
-
17
- ## ARGUMENTS
14
+ ## Arguments
18
15
 
19
16
  * `NAME1` (required):
20
17
  First system description to compare.
@@ -22,8 +19,7 @@ be used to limit the output to the given scopes.
22
19
  * `NAME2` (required):
23
20
  Second system description to compare.
24
21
 
25
-
26
- ## OPTIONS
22
+ ## Options
27
23
 
28
24
  * `-s SCOPE`, `--scope=SCOPE` (optional):
29
25
  Limit output to the specified scope.
@@ -42,8 +38,7 @@ be used to limit the output to the given scopes.
42
38
  * `--html` (optional):
43
39
  Shows the comparison of two system descriptions in the web browser.
44
40
 
45
-
46
- ## EXAMPLES
41
+ ## Examples
47
42
 
48
43
  * Compare system descriptions saved as `earth` and `moon`:
49
44
 
@@ -1,7 +1,6 @@
1
-
2
1
  # config — Configure Machinery
3
2
 
4
- ## SYNOPSIS
3
+ ## Synopsis
5
4
 
6
5
  `machinery config`
7
6
 
@@ -11,8 +10,7 @@
11
10
 
12
11
  `machinery` help config
13
12
 
14
-
15
- ## DESCRIPTION
13
+ ## Description
16
14
 
17
15
  The `config` command shows or changes machinery's configuration.
18
16
 
@@ -22,15 +20,14 @@ If key and value are specified this configuration entry is set accordingly.
22
20
 
23
21
  The configuration is stored in `~/.machinery/machinery.config`.
24
22
 
25
- ## ARGUMENTS
23
+ ## Arguments
26
24
  * `KEY`:
27
25
  Name of the configuration entry.
28
26
 
29
27
  * `VALUE`:
30
28
  Value of the configuration entry.
31
29
 
32
-
33
- ## EXAMPLES
30
+ ## Examples
34
31
 
35
32
  * Turn off hints:
36
33