Sally’s DevOps Adventure: File Management and Reporting Automation
Meet Sally, a seasoned DevOps Engineer at TechEdge Solutions, a fast-growing company specializing in cloud infrastructure and automation tools. Sally’s role involves streamlining processes, automating repetitive tasks, and ensuring smooth operations for the company. Recently, Sally has been tasked with addressing two pressing challenges that hinder the efficiency of file management and reporting workflows.

Tasks to Accomplish
- File Renaming Utility: Automate the renaming of multiple files in a directory based on specific patterns or rules.
- Report Generator: Generate consistent and structured reports from data for regular updates.
Challenges
- File Renaming Utility:
- Files have inconsistent naming conventions, causing confusion.
- Manual renaming is time-consuming and error-prone.
- The utility must handle different file types and naming patterns.
- Report Generator:
- The team requires frequent updates but lacks a standardized format.
- Data for reports often comes from disparate sources, leading to inconsistency.
- Generating reports manually is slow and prone to missing critical details.
Pre-Requisites
Before diving into the solutions, Sally must ensure the following:
- Environment Setup:
- Python 3.8 or later installed.
- Basic knowledge of Python libraries such as
os, pandas, and file handling.
- Access:
- Sufficient permissions to access and modify the directory containing files.
- Access to the data sources for generating reports.
- Dependencies:
- Install required Python libraries:
Task 1: File Renaming Utility
To help automate the file renaming task, let’s start by defining some key rules for renaming files.
File Naming Rules
- Add a prefix to the file names.
- Ensure all file names are in lowercase.
- Replace spaces with underscores.
🚨 Question
Could you please create two files with incorrect names in your project folder?
Example Files
Incorrect Name 1.txt
Another Incorrect Name 2.txt
🚨 Question
Could you build the automation to work on above two files and fix their names according to the rules we establish ?
Task 2: Report Generator
-
Input data for the report - report-data
- Report Requirements:
Report Structure:
- Title: Include a clear and descriptive title for the report.
- Date: Add the date of the report generation.
- Summary: Provide a brief summary of the report’s contents.
- Data Sections: Organize data into sections with headings.
- Visuals: Incorporate charts or graphs if necessary for better data representation.
- Write the Script:
🚨 Question
Need to generate a script to automate the report generation for the input data “report-data.json” as per the report requirements outlined using python, pandas to summarise based on departments ?
Conclusion
With these utilities in place, Sally successfully tackles the challenges of file renaming and report generation. His solutions not only save time but also improve accuracy and consistency in TechEdge Solutions’ workflows. Sally’s efforts highlight the importance of automation in modern DevOps practices.
For users who want to review the solution, please refer to and access it from devops-challenges-3-solution.