Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CHEF-10698] [WIP] Bug fix for cross-device link issue #8415

Closed
wants to merge 6 commits into from

Conversation

deenchev
Copy link
Collaborator

@deenchev deenchev commented Apr 3, 2024

🔩 Description: What code changed, and why?

The code related to writing to temporary files, because there was an issue with several clients. We are aiming to use /hab/tmp for writing to temporary files from now on.

⛓️ Related Resources

https://chefio.atlassian.net/browse/CHEF-10698

👍 Definition of Done

The error does not appear when using automate-cli commands.

👟 How to Build and Test the Change

✅ Checklist

All PRs must tick these:

With occasional exceptions, all PRs from Progress employees must tick these:

  • Is the code clear? (complicated code or lots of comments--subdivide and use well-named methods, meaningful variable names, etc.)
  • Consistency checked? (user notifications, user prompts, visual patterns, code patterns, variable names)
  • Repeated code blocks eliminated? (adapt and reuse existing components, blocks, functions, etc.)
  • Spelling, grammar, typos checked? (at a minimum use make spell in any component directory)
  • Code well-formatted? (indents, line breaks, etc. improve rather than hinder readability)

All PRs from Progress employees should tick these if appropriate:

  • Tests added/updated? (all new code needs new tests)
  • Docs added/updated? (all customer-facing changes)

Please add a note next to any checkbox above if you are NOT ticking it.

📷 Screenshots, if applicable

Copy link

netlify bot commented Apr 3, 2024

👷 Deploy Preview for chef-automate processing.

Name Link
🔨 Latest commit fab0403
🔍 Latest deploy log https://app.netlify.com/sites/chef-automate/deploys/661453565f78a0000881dace

@deenchev deenchev requested a review from punitmundra April 3, 2024 12:21

SonarQube Quality Gate

Quality Gate failed

Failed condition 9.1% 9.1% Coverage on New Code (is less than 80%)

See analysis details on SonarQube

@deenchev deenchev self-assigned this Apr 4, 2024
@@ -56,7 +56,7 @@ func (srs *SystemResourcesServiceImpl) GetSystemResourcesForDeployment(nodeType
rootFreeSpaceCheck := srs.CheckFreeDiskSpaceOfDir("/", constants.ROOT_FREE_DISK_IN_PER, constants.ROOT_FREE_DISK_IN_GB, "/(root volume)")
srsResponse.Checks = append(srsResponse.Checks, *rootFreeSpaceCheck)

tmpDirPermissionCheck := srs.CheckPermissionOfDir("/tmp", constants.TMP_DIR_REQUIRED_PERMISSION, "/tmp permission")
tmpDirPermissionCheck := srs.CheckPermissionOfDir("/hab/tmp", constants.TMP_DIR_REQUIRED_PERMISSION, "/hab/tmp permission")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove that

@@ -44,7 +44,6 @@ var NEW_BIN_DIR = "/hab/pkgs/core/postgresql13/13.5/20220311204618/bin"
const (
AUTOMATE_VERSION = "3"
NEXT_AUTOMATE_VERSION = "4"
AUTOMATE_PG_MIGRATE_LOG_DIR = "/tmp"
OLD_PG_VERSION = "9.6"
OLD_PG_DATA_DIR = "/hab/svc/automate-postgresql/data/pgdata"
NEW_PG_DATA_DIR = "/hab/svc/automate-postgresql/data/pgdata13"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can remove the migration_pg.go changes
this will be for upgrade from 2.x to 3.x

@@ -398,8 +398,7 @@ func runGatherLogsLocalCmd(outfileOverride string, logLines uint64) error {
// TODO: This might not always be the right choice, we should look into
// assigning this dynamically or allow a config flag. Right now /tmp
// works on our target distros and this is just an emergency fallback
stagingDir := "/tmp"
archiveRoot, err := createTempDir(stagingDir, "log-gathering")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can remove this as well
gather-logs command is writing the logs into the /tmp
that automatically cleanup

@@ -41,14 +41,14 @@ const RELEASE_AND_VERSION_PATTERN = `.*-(\d+\.\d+\.*\d*)-(\d{14})-.*\.hart$`

const (
FRONTEND_COMMAND = `
sudo chef-automate config %s /tmp/%s;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can revert that change

@@ -63,7 +63,7 @@ const (

GET_FRONTEND_CONFIG = `echo "y" | sudo chef-automate config show %s`

PRE_FLIGHT_CHECK = `cd /tmp;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can revert that change

export TIMESTAMP=$(date +'%s');
sudo mv /etc/chef-automate/config.toml /etc/chef-automate/config.toml.$TIMESTAMP;
sudo chef-automate config show > sudo /etc/chef-automate/config.toml`

BACKEND_COMMAND = `
export TIMESTAMP=$(date +"%s");
echo "yes" | sudo hab config apply automate-ha-%s.default $(date '+%s') /tmp/%s;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can revert that change

@deenchev deenchev closed this Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants