Skip to content

Commit

Permalink
Merge pull request #28 from SumoLogic/fix/linux-permissions
Browse files Browse the repository at this point in the history
File ownership & permissions changes
  • Loading branch information
portertech authored Aug 24, 2023
2 parents 5486db9 + b727685 commit 73f2aa0
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions assets/conf.d/common.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
extensions:
sumologic:
collector_fields: {}
1 change: 1 addition & 0 deletions assets/deb/conffiles
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/etc/otelcol-sumo/sumologic.yaml
/etc/otelcol-sumo/conf.d/common.yaml
/etc/otelcol-sumo/env/token.env
4 changes: 2 additions & 2 deletions components/otelcol-sumo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ macro(install_otc_config_directory)
DIRECTORY_PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
WORLD_EXECUTE
COMPONENT otelcol-sumo
)
endmacro()
Expand Down Expand Up @@ -292,7 +292,7 @@ macro(install_otc_linux_hostmetrics_yaml)
)
endmacro()

# e.g. /etc/otelcol-sumo/sumologic.yaml
# e.g. /lib/systemd/system/sumologic.yaml
macro(install_otc_service_systemd)
require_variables(
"ASSETS_DIR"
Expand Down
1 change: 1 addition & 0 deletions settings/rpm/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ macro(set_common_rpm_settings)
set(CPACK_RPM_PACKAGE_ARCHITECTURE "${package_arch}")
set(CPACK_RPM_PACKAGE_LICENSE "Apache-2.0")
set(PACKAGE_FILE_EXTENSION "rpm")
set(CPACK_RPM_PACKAGE_RELEASE "${BUILD_NUMBER}")

set(CPACK_PACKAGE_FILE_NAME "${package_name}-${PROJECT_VERSION}-${BUILD_NUMBER}.${package_arch}")
if (DEFINED goarm)
Expand Down
6 changes: 4 additions & 2 deletions settings/rpm/otc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ macro(set_otc_rpm_settings)
render_rpm_hook_templates()

set(CPACK_RPM_USER_FILELIST
# Mark sumologic.yaml as a config file to prevent package upgrades from
# replacing the file by default
# Mark config files to prevent package upgrades from replacing the file by
# default
"%config(noreplace) /etc/otelcol-sumo/sumologic.yaml"
"%config(noreplace) /etc/otelcol-sumo/conf.d/common.yaml"
"%config(noreplace) /etc/otelcol-sumo/env/token.env"
)

# Exclude these directories from the RPM as they should already exist and
Expand Down
1 change: 1 addition & 0 deletions templates/hooks/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ function(render_common_hook_templates)
"SERVICE_USER"
"SERVICE_GROUP"
"SERVICE_USER_HOME"
"OTC_CONFIG_DIR"
"OTC_CONFIG_PATH"
"OTC_USER_ENV_DIR"
"OTC_CONFIG_FRAGMENT_DIR"
Expand Down
3 changes: 3 additions & 0 deletions templates/hooks/common/otc-linux-functions.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ set_file_ownership()
{
chown -R @SERVICE_USER@:@SERVICE_GROUP@ \
@SERVICE_USER_HOME@ \
@OTC_CONFIG_DIR@ \
@OTC_SUMOLOGIC_CONFIG_PATH@ \
@SERVICE_USER_HOME@ \
@OTC_CONFIG_DIR@ \
@OTC_USER_ENV_DIR@ \
@OTC_CONFIG_FRAGMENTS_DIR@
}
1 change: 1 addition & 0 deletions templates/hooks/rpm/after-install.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ case "$1" in
set_file_ownership
;;
2) # upgrade
set_file_ownership
;;

esac
Expand Down

0 comments on commit 73f2aa0

Please sign in to comment.