Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
cdist
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
41
Issues
41
List
Boards
Labels
Service Desk
Milestones
Merge Requests
15
Merge Requests
15
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ungleich-public
cdist
Commits
9eacba06
Commit
9eacba06
authored
Feb 26, 2020
by
ssrq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[__file] Treat pre-exists as a special case in gencode-remote as it should never get there
parent
46d2487f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
26 deletions
+30
-26
cdist/conf/type/__file/gencode-remote
cdist/conf/type/__file/gencode-remote
+30
-26
No files found.
cdist/conf/type/__file/gencode-remote
View file @
9eacba06
...
...
@@ -55,37 +55,41 @@ set_owner() {
}
set_mode
()
{
echo
"chmod '
$1
' '
$destination
'"
echo
"chmod '
$1
'"
>>
"
$__messages_out
"
fire_onchange
=
1
echo
"chmod '
$1
' '
$destination
'"
echo
"chmod '
$1
'"
>>
"
$__messages_out
"
fire_onchange
=
1
}
case
"
$state_should
"
in
present|exists
|pre-exists
)
# Note: Mode - needs to happen last as a chown/chgrp can alter mode by
# clearing S_ISUID and S_ISGID bits (see chown(2))
for
attribute
in
group owner mode
;
do
if
[
-f
"
$__object
/parameter/
$attribute
"
]
;
then
value_should
=
"
$(
cat
"
$__object
/parameter/
$attribute
"
)
"
present|exists
)
# Note: Mode - needs to happen last as a chown/chgrp can alter mode by
# clearing S_ISUID and S_ISGID bits (see chown(2))
for
attribute
in
group owner mode
;
do
if
[
-f
"
$__object
/parameter/
$attribute
"
]
;
then
value_should
=
"
$(
cat
"
$__object
/parameter/
$attribute
"
)
"
# change 0xxx format to xxx format => same as stat returns
if
[
"
$attribute
"
=
mode
]
;
then
value_should
=
"
$(
echo
"
$value_should
"
|
sed
's/^0\(...\)/\1/'
)
"
fi
value_is
=
"
$(
get_current_value
"
$attribute
"
"
$value_should
"
)
"
if
[
-f
"
$__object
/files/set-attributes"
]
||
[
"
$value_should
"
!=
"
$value_is
"
]
;
then
"set_
$attribute
"
"
$value_should
"
# change 0xxx format to xxx format => same as stat returns
if
[
"
$attribute
"
=
mode
]
;
then
value_should
=
"
$(
echo
"
$value_should
"
|
sed
's/^0\(...\)/\1/'
)
"
fi
value_is
=
"
$(
get_current_value
"
$attribute
"
"
$value_should
"
)
"
if
[
-f
"
$__object
/files/set-attributes"
]
||
[
"
$value_should
"
!=
"
$value_is
"
]
;
then
"set_
$attribute
"
"
$value_should
"
fi
fi
done
if
[
-f
"
$__object
/files/set-attributes"
]
;
then
# set-attributes is created if file is created or uploaded in gencode-local
fire_onchange
=
1
fi
done
if
[
-f
"
$__object
/files/set-attributes"
]
;
then
# set-attributes is created if file is created or uploaded in gencode-local
fire_onchange
=
1
fi
;;
pre-exists
)
# pre-exists should never reach gencode-remote…
exit
1
;;
absent
)
if
[
"
$type
"
=
"file"
]
;
then
echo
"rm -f '
$destination
'"
...
...
@@ -101,7 +105,7 @@ case "$state_should" in
esac
if
[
-f
"
$__object
/parameter/onchange"
]
;
then
if
[
-n
"
$fire_onchange
"
]
;
then
cat
"
$__object
/parameter/onchange"
fi
if
[
-n
"
$fire_onchange
"
]
;
then
cat
"
$__object
/parameter/onchange"
fi
fi
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment