machinery-tool 1.2.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS +16 -0
- data/bin/machinery +1 -1
- data/export_helpers/merge_users_and_groups.pl.erb +1 -1
- data/export_helpers/unmanaged_files_autoyast_excludes +10 -0
- data/export_helpers/{unmanaged_files_build_excludes → unmanaged_files_kiwi_excludes} +1 -0
- data/helpers/changed_managed_files.sh +1 -1
- data/helpers/yum_repositories.py +37 -0
- data/html/assets/machinery.js +76 -57
- data/html/assets/reset.png +0 -0
- data/html/index.html.haml +6 -2
- data/lib/analyze_config_file_diffs_task.rb +5 -4
- data/lib/array.rb +1 -1
- data/lib/autoyast.rb +16 -8
- data/lib/build_task.rb +2 -1
- data/lib/changed_rpm_files_helper.rb +1 -1
- data/lib/cli.rb +13 -9
- data/lib/compare_task.rb +1 -1
- data/lib/config.rb +1 -1
- data/lib/config_base.rb +1 -1
- data/lib/config_task.rb +1 -1
- data/lib/constants.rb +1 -1
- data/lib/copy_task.rb +1 -1
- data/lib/current_user.rb +1 -1
- data/lib/deploy_task.rb +4 -1
- data/lib/exceptions.rb +5 -2
- data/lib/export_task.rb +8 -2
- data/lib/exporter.rb +1 -1
- data/lib/file_validator.rb +107 -0
- data/lib/generate_html_task.rb +1 -1
- data/lib/helper.rb +18 -1
- data/lib/hint.rb +1 -1
- data/lib/html.rb +8 -3
- data/lib/inspect_task.rb +3 -4
- data/lib/inspector.rb +1 -1
- data/lib/json_validation_error_cleaner.rb +78 -0
- data/lib/json_validator.rb +86 -0
- data/lib/kiwi_config.rb +6 -4
- data/lib/list_task.rb +33 -39
- data/lib/local_system.rb +20 -27
- data/lib/logged_cheetah.rb +1 -1
- data/lib/machinery.rb +5 -2
- data/lib/machinery_logger.rb +1 -1
- data/lib/manifest.rb +16 -5
- data/lib/migration.rb +40 -10
- data/lib/mountpoints.rb +1 -1
- data/lib/object.rb +10 -11
- data/lib/remote_system.rb +1 -1
- data/lib/remove_task.rb +19 -14
- data/lib/renderer.rb +6 -5
- data/lib/renderer_helper.rb +1 -1
- data/lib/rpm.rb +1 -1
- data/lib/scope_file_store.rb +1 -1
- data/lib/scope_mixin.rb +1 -1
- data/lib/show_task.rb +1 -1
- data/lib/system.rb +9 -2
- data/lib/system_description.rb +45 -55
- data/lib/system_description_memory_store.rb +1 -1
- data/lib/system_description_store.rb +29 -58
- data/lib/tarball.rb +18 -12
- data/lib/ui.rb +1 -1
- data/lib/upgrade_format_task.rb +12 -11
- data/lib/validate_task.rb +5 -2
- data/lib/version.rb +2 -2
- data/lib/zypper.rb +15 -11
- data/man/generated/machinery.1.gz +0 -0
- data/man/generated/machinery.1.html +20 -10
- data/plugins/inspect/changed_managed_files_inspector.rb +1 -1
- data/plugins/inspect/config_files_inspector.rb +1 -1
- data/plugins/inspect/groups_inspector.rb +1 -1
- data/plugins/inspect/os_inspector.rb +19 -1
- data/plugins/inspect/packages_inspector.rb +1 -1
- data/plugins/inspect/patterns_inspector.rb +14 -30
- data/plugins/inspect/repositories_inspector.rb +137 -77
- data/plugins/inspect/services_inspector.rb +42 -19
- data/plugins/inspect/unmanaged_files_inspector.rb +1 -1
- data/plugins/inspect/users_inspector.rb +1 -1
- data/plugins/model/changed_managed_files_model.rb +1 -1
- data/plugins/model/config_files_model.rb +1 -1
- data/plugins/model/file_scope.rb +2 -2
- data/plugins/model/groups_model.rb +1 -1
- data/plugins/model/os_model.rb +60 -8
- data/plugins/model/packages_model.rb +1 -1
- data/plugins/model/patterns_model.rb +1 -1
- data/plugins/model/repositories_model.rb +1 -1
- data/plugins/model/services_model.rb +1 -1
- data/plugins/model/unmanaged_files_model.rb +1 -1
- data/plugins/model/users_model.rb +1 -1
- data/plugins/schema/v3/system-description-changed-managed-files.schema.json +92 -0
- data/plugins/schema/v3/system-description-config-files.schema.json +92 -0
- data/plugins/schema/v3/system-description-groups.schema.json +30 -0
- data/plugins/schema/v3/system-description-os.schema.json +21 -0
- data/plugins/schema/v3/system-description-packages.schema.json +34 -0
- data/plugins/schema/v3/system-description-patterns.schema.json +24 -0
- data/plugins/schema/v3/system-description-repositories.schema.json +45 -0
- data/plugins/schema/v3/system-description-services.schema.json +30 -0
- data/plugins/schema/v3/system-description-unmanaged-files.schema.json +138 -0
- data/plugins/schema/v3/system-description-users.schema.json +61 -0
- data/plugins/show/changed_managed_files_renderer.rb +1 -1
- data/plugins/show/config_files_renderer.rb +2 -2
- data/plugins/show/groups_renderer.rb +1 -1
- data/plugins/show/os_renderer.rb +1 -1
- data/plugins/show/packages_renderer.rb +1 -1
- data/plugins/show/patterns_renderer.rb +1 -1
- data/plugins/show/repositories_renderer.rb +8 -3
- data/plugins/show/services_renderer.rb +1 -1
- data/plugins/show/unmanaged_files_renderer.rb +1 -1
- data/plugins/show/users_renderer.rb +1 -1
- data/schema/migrations/migrate1to2.rb +1 -1
- data/schema/migrations/migrate2to3.rb +42 -0
- data/schema/v3/system-description-global.schema.json +31 -0
- metadata +147 -130
- data/lib/system_description_validator.rb +0 -216
data/lib/mountpoints.rb
CHANGED
data/lib/object.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2013-
|
1
|
+
# Copyright (c) 2013-2015 SUSE LLC
|
2
2
|
#
|
3
3
|
# This program is free software; you can redistribute it and/or
|
4
4
|
# modify it under the terms of version 3 of the GNU General Public License as
|
@@ -20,15 +20,15 @@ module Machinery
|
|
20
20
|
class << self
|
21
21
|
def has_property(name, options)
|
22
22
|
@property_classes ||= {}
|
23
|
-
@property_classes[name.
|
23
|
+
@property_classes[name.to_s] = options[:class]
|
24
24
|
end
|
25
25
|
|
26
26
|
def object_hash_from_json(json)
|
27
27
|
return nil unless json
|
28
28
|
|
29
29
|
entries = json.map do |key, value|
|
30
|
-
value_converted = if @property_classes && @property_classes[key.
|
31
|
-
@property_classes[key.
|
30
|
+
value_converted = if @property_classes && @property_classes[key.to_s]
|
31
|
+
@property_classes[key.to_s].from_json(value)
|
32
32
|
else
|
33
33
|
case value
|
34
34
|
when ::Array
|
@@ -59,7 +59,7 @@ module Machinery
|
|
59
59
|
|
60
60
|
def set_attributes(attrs)
|
61
61
|
@attributes = attrs.inject({}) do |attributes, (key, value)|
|
62
|
-
key = key.
|
62
|
+
key = key.to_s if key.is_a?(Symbol)
|
63
63
|
|
64
64
|
attributes[key] = value
|
65
65
|
attributes
|
@@ -80,11 +80,11 @@ module Machinery
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def [](key)
|
83
|
-
@attributes[key.
|
83
|
+
@attributes[key.to_s]
|
84
84
|
end
|
85
85
|
|
86
86
|
def []=(key, value)
|
87
|
-
@attributes[key.
|
87
|
+
@attributes[key.to_s] = value
|
88
88
|
end
|
89
89
|
|
90
90
|
def empty?
|
@@ -96,15 +96,14 @@ module Machinery
|
|
96
96
|
if args.size != 1
|
97
97
|
raise ArgumentError, "wrong number of arguments (#{args.size} for 1)"
|
98
98
|
end
|
99
|
-
|
100
|
-
@attributes[name.to_s[0..-2].to_sym] = args.first
|
99
|
+
@attributes[name.to_s[0..-2].to_s] = args.first
|
101
100
|
else
|
102
|
-
if @attributes.has_key?(name)
|
101
|
+
if @attributes.has_key?(name.to_s)
|
103
102
|
if !args.empty?
|
104
103
|
raise ArgumentError, "wrong number of arguments (#{args.size} for 0)"
|
105
104
|
end
|
106
105
|
|
107
|
-
@attributes[name]
|
106
|
+
@attributes[name.to_s]
|
108
107
|
else
|
109
108
|
nil
|
110
109
|
end
|
data/lib/remote_system.rb
CHANGED
data/lib/remove_task.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2013-
|
1
|
+
# Copyright (c) 2013-2015 SUSE LLC
|
2
2
|
#
|
3
3
|
# This program is free software; you can redistribute it and/or
|
4
4
|
# modify it under the terms of version 3 of the GNU General Public License as
|
@@ -16,28 +16,33 @@
|
|
16
16
|
# you may find current contact information at www.suse.com
|
17
17
|
|
18
18
|
class RemoveTask
|
19
|
-
def remove(store,
|
20
|
-
if !options[:all] && !store.list.include?(name)
|
21
|
-
raise Machinery::Errors::SystemDescriptionNotFound.new(
|
22
|
-
"System description \"#{name}\" does not exist."
|
23
|
-
)
|
24
|
-
end
|
25
|
-
|
19
|
+
def remove(store, names, options = {})
|
26
20
|
if options[:all]
|
27
21
|
removed_descriptions = store.list
|
28
22
|
removed_descriptions.each do |name|
|
29
23
|
store.remove(name)
|
30
24
|
end
|
31
|
-
else
|
32
|
-
store.remove(name)
|
33
|
-
end
|
34
25
|
|
35
|
-
|
36
|
-
if options[:all]
|
26
|
+
if options[:verbose]
|
37
27
|
Machinery::Ui.puts "Removed #{removed_descriptions.length} system descriptions successfully."
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
errors = []
|
32
|
+
|
33
|
+
Array(names).each do |name|
|
34
|
+
if !store.list.include?(name)
|
35
|
+
errors.push("System description \"#{name}\" does not exist.")
|
38
36
|
else
|
39
|
-
|
37
|
+
store.remove(name)
|
38
|
+
if options[:verbose]
|
39
|
+
Machinery::Ui.puts "System description \"#{name}\" successfully removed."
|
40
|
+
end
|
40
41
|
end
|
41
42
|
end
|
43
|
+
|
44
|
+
if !errors.empty?
|
45
|
+
raise Machinery::Errors::SystemDescriptionNotFound.new(errors.join("\n"))
|
46
|
+
end
|
42
47
|
end
|
43
48
|
end
|
data/lib/renderer.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2013-
|
1
|
+
# Copyright (c) 2013-2015 SUSE LLC
|
2
2
|
#
|
3
3
|
# This program is free software; you can redistribute it and/or
|
4
4
|
# modify it under the terms of version 3 of the GNU General Public License as
|
@@ -148,16 +148,17 @@ class Renderer
|
|
148
148
|
@stack = []
|
149
149
|
missing_descriptions = Array.new
|
150
150
|
|
151
|
-
|
152
|
-
|
153
|
-
if !description1[scope]
|
151
|
+
if !description1[scope]
|
154
152
|
missing_descriptions << description1.name
|
155
153
|
end
|
156
154
|
if !description2[scope]
|
157
155
|
missing_descriptions << description2.name
|
158
156
|
end
|
159
157
|
|
160
|
-
|
158
|
+
if missing_descriptions.count == 1
|
159
|
+
@buffer += "# #{display_name}\n"
|
160
|
+
indent { puts "Unable to compare, no data in '#{missing_descriptions.join("', '")}'" }
|
161
|
+
end
|
161
162
|
@buffer += "\n" unless @buffer.empty? || @buffer.end_with?("\n\n")
|
162
163
|
|
163
164
|
@buffer
|
data/lib/renderer_helper.rb
CHANGED
data/lib/rpm.rb
CHANGED
data/lib/scope_file_store.rb
CHANGED
data/lib/scope_mixin.rb
CHANGED
data/lib/show_task.rb
CHANGED
data/lib/system.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2013-
|
1
|
+
# Copyright (c) 2013-2015 SUSE LLC
|
2
2
|
#
|
3
3
|
# This program is free software; you can redistribute it and/or
|
4
4
|
# modify it under the terms of version 3 of the GNU General Public License as
|
@@ -55,7 +55,7 @@ class System
|
|
55
55
|
out = File.open(archive, "w")
|
56
56
|
begin
|
57
57
|
run_command(
|
58
|
-
"tar", "--
|
58
|
+
"tar", "--create", "--gzip", "--null", "--files-from=-",
|
59
59
|
*exclude.flat_map { |f| ["--exclude", f]},
|
60
60
|
:stdout => out,
|
61
61
|
:stdin => filelist
|
@@ -78,4 +78,11 @@ class System
|
|
78
78
|
|
79
79
|
run_command("bash", "-c", script, *args)
|
80
80
|
end
|
81
|
+
|
82
|
+
def has_command?(command)
|
83
|
+
run_command("bash", "-c", "type -P #{command}", stdout: :capture)
|
84
|
+
true
|
85
|
+
rescue Cheetah::ExecutionFailed
|
86
|
+
false
|
87
|
+
end
|
81
88
|
end
|
data/lib/system_description.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2013-
|
1
|
+
# Copyright (c) 2013-2015 SUSE LLC
|
2
2
|
#
|
3
3
|
# This program is free software; you can redistribute it and/or
|
4
4
|
# modify it under the terms of version 3 of the GNU General Public License as
|
@@ -26,7 +26,7 @@
|
|
26
26
|
# The sub directories storing the data for specific scopes are handled by the
|
27
27
|
# ScopeFileStore class.
|
28
28
|
class SystemDescription < Machinery::Object
|
29
|
-
CURRENT_FORMAT_VERSION =
|
29
|
+
CURRENT_FORMAT_VERSION = 3
|
30
30
|
EXTRACTABLE_SCOPES = [
|
31
31
|
"changed_managed_files",
|
32
32
|
"config_files",
|
@@ -41,13 +41,17 @@ class SystemDescription < Machinery::Object
|
|
41
41
|
# Load the system description with the given name
|
42
42
|
#
|
43
43
|
# If there are file validation errors the call fails with an exception
|
44
|
-
def load!(name, store)
|
44
|
+
def load!(name, store, options = {})
|
45
45
|
manifest = Manifest.load(name, store.manifest_path(name))
|
46
|
-
manifest.validate
|
46
|
+
manifest.validate!
|
47
47
|
|
48
48
|
description = from_hash(name, store, manifest.to_hash)
|
49
|
-
description.
|
50
|
-
|
49
|
+
description.validate_file_data!
|
50
|
+
|
51
|
+
if !options[:skip_format_compatibility]
|
52
|
+
description.validate_format_compatibility
|
53
|
+
end
|
54
|
+
|
51
55
|
description
|
52
56
|
end
|
53
57
|
|
@@ -55,18 +59,15 @@ class SystemDescription < Machinery::Object
|
|
55
59
|
#
|
56
60
|
# If there are file validation errors these are put out as warnings but the
|
57
61
|
# loading of the system description succeeds.
|
58
|
-
def load(name, store)
|
62
|
+
def load(name, store, options = {})
|
59
63
|
manifest = Manifest.load(name, store.manifest_path(name))
|
60
|
-
manifest.validate
|
64
|
+
manifest.validate if !options[:skip_validation]
|
61
65
|
|
62
66
|
description = from_hash(name, store, manifest.to_hash)
|
63
|
-
description.
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
Machinery::Ui.warn("Warning: File validation errors:")
|
68
|
-
Machinery::Ui.warn(e.to_s)
|
69
|
-
end
|
67
|
+
description.validate_file_data if !options[:skip_validation]
|
68
|
+
|
69
|
+
description.validate_format_compatibility if !options[:skip_format_compatibility]
|
70
|
+
|
70
71
|
description
|
71
72
|
end
|
72
73
|
|
@@ -133,12 +134,26 @@ class SystemDescription < Machinery::Object
|
|
133
134
|
format_version == SystemDescription::CURRENT_FORMAT_VERSION
|
134
135
|
end
|
135
136
|
|
136
|
-
def
|
137
|
+
def validate_format_compatibility
|
137
138
|
if !compatible?
|
138
139
|
raise Machinery::Errors::SystemDescriptionIncompatible.new(self.name)
|
139
140
|
end
|
140
141
|
end
|
141
142
|
|
143
|
+
def validate_analysis_compatibility
|
144
|
+
if !os.can_be_analyzed?
|
145
|
+
raise Machinery::Errors::AnalysisFailed.new("Analysis of operating " +
|
146
|
+
"system '#{os.display_name}' is not supported.")
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
def validate_export_compatibility
|
151
|
+
if !os.can_be_exported?
|
152
|
+
raise Machinery::Errors::ExportFailed.new("Export of operating " +
|
153
|
+
"system '#{os.display_name}' is not supported.")
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
142
157
|
def to_hash
|
143
158
|
meta = {}
|
144
159
|
meta["format_version"] = self.format_version if self.format_version
|
@@ -200,50 +215,25 @@ class SystemDescription < Machinery::Object
|
|
200
215
|
ScopeFileStore.new(description_path, store_name)
|
201
216
|
end
|
202
217
|
|
203
|
-
def
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
file_store = scope_file_store(scope)
|
211
|
-
file_list.map! { |file| File.join(file_store.path, file) }
|
212
|
-
files = file_store.list_content
|
213
|
-
|
214
|
-
files - file_list
|
218
|
+
def validate_file_data
|
219
|
+
errors = FileValidator.new(to_hash, description_path).validate
|
220
|
+
if !errors.empty?
|
221
|
+
Machinery::Ui.warn("Warning: File validation errors:")
|
222
|
+
Machinery::Ui.warn("Error validating description '#{@name}'\n\n")
|
223
|
+
Machinery::Ui.warn(errors)
|
224
|
+
end
|
215
225
|
end
|
216
226
|
|
217
|
-
def validate_file_data
|
218
|
-
|
227
|
+
def validate_file_data!
|
228
|
+
errors = FileValidator.new(to_hash, description_path).validate
|
229
|
+
if !errors.empty?
|
230
|
+
e = Machinery::Errors::SystemDescriptionValidationFailed.new(errors)
|
231
|
+
e.header = "Error validating description '#{@name}'"
|
232
|
+
raise e
|
233
|
+
end
|
219
234
|
end
|
220
235
|
|
221
236
|
def description_path
|
222
237
|
@store.description_path(name)
|
223
238
|
end
|
224
|
-
|
225
|
-
# Filestore handling
|
226
|
-
def initialize_file_store(store_name)
|
227
|
-
@store.initialize_file_store(self.name, store_name)
|
228
|
-
end
|
229
|
-
|
230
|
-
def file_store(store_name)
|
231
|
-
@store.file_store(self.name, store_name)
|
232
|
-
end
|
233
|
-
|
234
|
-
def remove_file_store(store_name)
|
235
|
-
@store.remove_file_store(self.name, store_name)
|
236
|
-
end
|
237
|
-
|
238
|
-
def rename_file_store(old_name, new_name)
|
239
|
-
@store.rename_file_store(self.name, old_name, new_name)
|
240
|
-
end
|
241
|
-
|
242
|
-
def list_file_store_content(store_name)
|
243
|
-
@store.list_file_store_content(self.name, store_name)
|
244
|
-
end
|
245
|
-
|
246
|
-
def create_file_store_sub_dir(store_name, sub_dir)
|
247
|
-
@store.create_file_store_sub_dir(self.name, store_name, sub_dir)
|
248
|
-
end
|
249
239
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2013-
|
1
|
+
# Copyright (c) 2013-2015 SUSE LLC
|
2
2
|
#
|
3
3
|
# This program is free software; you can redistribute it and/or
|
4
4
|
# modify it under the terms of version 3 of the GNU General Public License as
|
@@ -67,28 +67,16 @@ class SystemDescriptionStore
|
|
67
67
|
def copy(from, to)
|
68
68
|
SystemDescription.validate_name(from)
|
69
69
|
SystemDescription.validate_name(to)
|
70
|
-
if !list.include?(from)
|
71
|
-
raise Machinery::Errors::SystemDescriptionNotFound.new(
|
72
|
-
"System description \"#{from}\" does not exist."
|
73
|
-
)
|
74
|
-
end
|
75
70
|
|
76
|
-
|
77
|
-
|
78
|
-
"A System description with the name \"#{to}\" does already exist."
|
79
|
-
)
|
80
|
-
end
|
71
|
+
validate_existence_of_description(from)
|
72
|
+
validate_nonexistence_of_description(to)
|
81
73
|
|
82
74
|
FileUtils.cp_r(description_path(from), description_path(to))
|
83
75
|
end
|
84
76
|
|
85
77
|
def backup(description_name)
|
86
78
|
SystemDescription.validate_name(description_name)
|
87
|
-
|
88
|
-
raise Machinery::Errors::SystemDescriptionNotFound.new(
|
89
|
-
"System description \"#{description_name}\" does not exist."
|
90
|
-
)
|
91
|
-
end
|
79
|
+
validate_existence_of_description(description_name)
|
92
80
|
|
93
81
|
backup_name = get_backup_name(description_name)
|
94
82
|
|
@@ -99,55 +87,22 @@ class SystemDescriptionStore
|
|
99
87
|
def rename(from, to)
|
100
88
|
SystemDescription.validate_name(from)
|
101
89
|
SystemDescription.validate_name(to)
|
102
|
-
if !list.include?(from)
|
103
|
-
raise Machinery::Errors::SystemDescriptionNotFound.new(
|
104
|
-
"System description \"#{from}\" does not exist."
|
105
|
-
)
|
106
|
-
end
|
107
90
|
|
108
|
-
|
109
|
-
|
110
|
-
"A System description with the name \"#{to}\" does already exist."
|
111
|
-
)
|
112
|
-
end
|
91
|
+
validate_existence_of_description(from)
|
92
|
+
validate_nonexistence_of_description(to)
|
113
93
|
|
114
94
|
FileUtils.mv(description_path(from), description_path(to))
|
115
95
|
end
|
116
96
|
|
117
|
-
def
|
118
|
-
|
119
|
-
|
120
|
-
file_store.create
|
121
|
-
end
|
97
|
+
def swap(description_name_1, description_name_2)
|
98
|
+
validate_existence_of_description(description_name_1)
|
99
|
+
validate_existence_of_description(description_name_2)
|
122
100
|
|
123
|
-
|
124
|
-
file_store = ScopeFileStore.new(description_path(description_name),
|
125
|
-
store_name)
|
126
|
-
file_store.path
|
127
|
-
end
|
101
|
+
tmp_description_name = "#{description_name_1}-#{Time.now.to_i}-#{rand(1000)}"
|
128
102
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
file_store.remove
|
133
|
-
end
|
134
|
-
|
135
|
-
def rename_file_store(description_name, store_old, store_new)
|
136
|
-
file_store = ScopeFileStore.new(description_path(description_name),
|
137
|
-
store_old)
|
138
|
-
file_store.rename(store_new)
|
139
|
-
end
|
140
|
-
|
141
|
-
def create_file_store_sub_dir(description_name, store_name, sub_dir)
|
142
|
-
file_store = ScopeFileStore.new(description_path(description_name),
|
143
|
-
store_name)
|
144
|
-
file_store.create_sub_directory(sub_dir)
|
145
|
-
end
|
146
|
-
|
147
|
-
def list_file_store_content(description_name, store_name)
|
148
|
-
file_store = ScopeFileStore.new(description_path(description_name),
|
149
|
-
store_name)
|
150
|
-
file_store.list_content
|
103
|
+
FileUtils.mv(description_path(description_name_1), description_path(tmp_description_name))
|
104
|
+
FileUtils.mv(description_path(description_name_2), description_path(description_name_1))
|
105
|
+
FileUtils.mv(description_path(tmp_description_name), description_path(description_name_2))
|
151
106
|
end
|
152
107
|
|
153
108
|
def directory_for(name)
|
@@ -175,4 +130,20 @@ class SystemDescriptionStore
|
|
175
130
|
|
176
131
|
backup_name
|
177
132
|
end
|
133
|
+
|
134
|
+
def validate_existence_of_description(description_name)
|
135
|
+
if !list.include?(description_name)
|
136
|
+
raise Machinery::Errors::SystemDescriptionNotFound.new(
|
137
|
+
"System description \"#{description_name}\" does not exist."
|
138
|
+
)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
def validate_nonexistence_of_description(description_name)
|
143
|
+
if list.include?(description_name)
|
144
|
+
raise Machinery::Errors::SystemDescriptionError.new(
|
145
|
+
"A System description with the name \"#{description_name}\" does already exist."
|
146
|
+
)
|
147
|
+
end
|
148
|
+
end
|
178
149
|
end
|