Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cfgfile
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nationellt superdatorcentrum
puppetmodules
cfgfile
Commits
74434190
Commit
74434190
authored
17 years ago
by
Thomas Bellman
Committed by
Thomas Bellman
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Renamed common resource type parameter 'not_on' to 'skip'.
This was originally commit 5be54fe20939 in nsc-puppet-utils.
parent
35c46403
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Lib/puppet/type/delete_lines.rb
+1
-1
1 addition, 1 deletion
Lib/puppet/type/delete_lines.rb
Lib/puppet/type/regexp_replace_lines.rb
+4
-4
4 additions, 4 deletions
Lib/puppet/type/regexp_replace_lines.rb
Lib/ruby/nsc_utils.rb
+4
-4
4 additions, 4 deletions
Lib/ruby/nsc_utils.rb
with
9 additions
and
9 deletions
Lib/puppet/type/delete_lines.rb
+
1
−
1
View file @
74434190
...
@@ -69,7 +69,7 @@ Puppet::Type.newtype(:delete_lines) do
...
@@ -69,7 +69,7 @@ Puppet::Type.newtype(:delete_lines) do
end
end
end
end
newparam
(
:
not_on
)
do
newparam
(
:
skip
)
do
desc
"Don't delete lines looking like this regexp (implicitly
desc
"Don't delete lines looking like this regexp (implicitly
anchored at the beginning and end of the line).
anchored at the beginning and end of the line).
"
"
...
...
This diff is collapsed.
Click to expand it.
Lib/puppet/type/regexp_replace_lines.rb
+
4
−
4
View file @
74434190
...
@@ -4,7 +4,7 @@ require 'nsc_utils'
...
@@ -4,7 +4,7 @@ require 'nsc_utils'
Puppet
::
Type
.
newtype
(
:regexp_replace_lines
)
do
Puppet
::
Type
.
newtype
(
:regexp_replace_lines
)
do
@doc
=
"Replace lines in the file :file matching regexp :pattern with
@doc
=
"Replace lines in the file :file matching regexp :pattern with
:replacement, unless they also match the regexp :
not_on
. The
:replacement, unless they also match the regexp :
skip
. The
pattern is implicitly anchored at the start and end of the line.
pattern is implicitly anchored at the start and end of the line.
The replacement text can use the standard Ruby regexp replacement
The replacement text can use the standard Ruby regexp replacement
back-references.
back-references.
...
@@ -93,7 +93,7 @@ Puppet::Type.newtype(:regexp_replace_lines) do
...
@@ -93,7 +93,7 @@ Puppet::Type.newtype(:regexp_replace_lines) do
end
end
end
end
newparam
(
:
not_on
)
do
newparam
(
:
skip
)
do
desc
"Don't replace lines looking like this regexp (implicitly
desc
"Don't replace lines looking like this regexp (implicitly
anchored at the beginning and end of the line).
anchored at the beginning and end of the line).
"
"
...
@@ -128,14 +128,14 @@ Puppet::Type.newtype(:regexp_replace_lines) do
...
@@ -128,14 +128,14 @@ Puppet::Type.newtype(:regexp_replace_lines) do
def
sync
def
sync
lines
=
@saves
[
:lines
]
lines
=
@saves
[
:lines
]
pattern
=
@saves
[
:pattern
]
pattern
=
@saves
[
:pattern
]
not_on
=
@saves
[
:
not_on
]
skip
=
@saves
[
:
skip
]
replacement
=
self
.
value
replacement
=
self
.
value
for
i
in
@to_replace
for
i
in
@to_replace
l
=
lines
[
i
]
l
=
lines
[
i
]
l2
=
l
.
chomp
l2
=
l
.
chomp
r
=
l2
.
sub
(
pattern
,
replacement
)
r
=
l2
.
sub
(
pattern
,
replacement
)
##puts "--DEBUG: #{i+1}: <#{l2}> => <#{r}>"
##puts "--DEBUG: #{i+1}: <#{l2}> => <#{r}>"
if
pattern
.
match
(
r
)
and
not
(
not_on
and
not_on
.
match
(
r
))
if
pattern
.
match
(
r
)
and
not
(
skip
and
skip
.
match
(
r
))
msg
=
"Result of replacement still matches on line
#{
i
+
1
}
"
msg
=
"Result of replacement still matches on line
#{
i
+
1
}
"
self
.
fail
(
msg
)
self
.
fail
(
msg
)
end
end
...
...
This diff is collapsed.
Click to expand it.
Lib/ruby/nsc_utils.rb
+
4
−
4
View file @
74434190
...
@@ -66,9 +66,9 @@ module NSC_Utils
...
@@ -66,9 +66,9 @@ module NSC_Utils
section_end
,
include_section_end
=
section_end
,
include_section_end
=
NSC_Utils
::
boundary
(
resources
,
:end
)
NSC_Utils
::
boundary
(
resources
,
:end
)
saves
[
:pattern
]
=
Regexp
.
new
(
'^'
+
resources
[
:pattern
]
+
'$'
)
saves
[
:pattern
]
=
Regexp
.
new
(
'^'
+
resources
[
:pattern
]
+
'$'
)
saves
[
:
not_on
]
=
resources
[
:
not_on
]
saves
[
:
skip
]
=
resources
[
:
skip
]
if
saves
[
:
not_on
]
if
saves
[
:
skip
]
saves
[
:
not_on
]
=
Regexp
.
new
(
'^'
+
saves
[
:
not_on
]
+
'$'
)
saves
[
:
skip
]
=
Regexp
.
new
(
'^'
+
saves
[
:
skip
]
+
'$'
)
end
end
saves
[
:lines
]
=
File
.
readlines
(
resources
[
:file
])
saves
[
:lines
]
=
File
.
readlines
(
resources
[
:file
])
...
@@ -86,7 +86,7 @@ module NSC_Utils
...
@@ -86,7 +86,7 @@ module NSC_Utils
for
sect
in
sections
for
sect
in
sections
for
l
,
i
in
sect
for
l
,
i
in
sect
if
saves
[
:pattern
].
match
(
l
)
if
saves
[
:pattern
].
match
(
l
)
unless
saves
[
:
not_on
]
and
saves
[
:
not_on
].
match
(
l
)
unless
saves
[
:
skip
]
and
saves
[
:
skip
].
match
(
l
)
yield
[
l
,
i
]
yield
[
l
,
i
]
end
end
end
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment