Граф коммитов

328 Коммитов

Автор SHA1 Сообщение Дата
Koshy John 530dec296c
Apt debstyle882 support, bug-fixes in cache evaluation & manipulation (#273) 2024-11-19 18:37:06 +00:00
Rajasi Rane 234fc37255
Expanding support for yum install --assumeno cmd to include yum4 (#272)
* Expanding support for yum install --assumeno cmd to include yum4

* Expanding support for yum: Addressing feedback #1
2024-11-19 09:40:39 -08:00
Koshy John 82b15b2692
Manual MaxPatchPublishDate selection through date versioning (#257)
* Manual MaxPatchPublishDate selection through date versioning

* Mitigation mode

* Enhanced mitigation mode

* Additional test coverage

* Modified check flow

* One additional line of code coverage

* Comments for code readability

* Different data validation method

* Additional error condition check

* Force codecov run

* Codecov reset

* Soft reset over master

* Test merge

* Additional asserts
2024-11-07 19:24:04 -08:00
feng-j678 e89747a52d
Pr1/increase_RebootManager_and_PatchAssessor_code coverage (#267)
* add ut for add_error_to_status

* add test_start_reboot()

* add logic to rset sys.stdout and add dummy test in rebootmanager.py

* modify start_reboot for testing

* use import six, StringIO works in py2 py3

* add ut for start_reboot raise exception

* create a new method to preserve start_reboot

* restore the sys.__stdout

* revert import to use io instead of six

* add ut for rebootifrequired

* test stringIO import

* restore configurepatchingprocessor and maintenancewindow tests as master

* refactor the test assessor throws exception
2024-11-06 16:59:44 -08:00
Koshy John c49a676315
Remove external dependencies from coverage, increase default target (#245)
* Remove external dependencies from coverage

* Retry path specification

* Update ci.yml

Reviewing what happens with dependencies

* Update codecov.yml

Experimenting

* Including contributing.md

* Trying exclusion per docs

* Trying this another way
2024-11-05 14:11:03 -08:00
Koshy John 96f6359806
Matching 20% increase in throttling limit at VM Agent (#277) 2024-11-05 13:53:19 -08:00
feng-j678 2730aae722
address the stringio getvalue not found error (#275) 2024-10-28 11:42:59 -07:00
feng-j678 82f45bb083
Bugfix/disable rhel8+ security plugin (#266)
* add logic to skip security plugin for rhel8+ images

* add log and ut for disable security plug for rhel8+

* refactor and remove prints and extra lines

* remove semicolon and reformat ut test_yumpkgmanager

* modify the log output

* refactor code
2024-10-07 10:11:54 -07:00
feng-j678 89b35c01d7
Fix broken 3-byte-unicode-related unit test in Python 2.x (#264)
* modify the utest to accept 3 bytes unicode in py27

* remove unused import

* add assertion for lower bound min msg limit

* remove assertion for checking equal message length

* remove € from test_statushandlertruncation.py
2024-09-23 15:00:39 -07:00
feng-j678 0824ba8e26
add unit testing to increase code coverage (#265)
* add raise exception utest in maintenance windows file

* add ut for log_to_stdout to true

* add test code to assert log output

* add raise exception test in Test_ConfigurePatchingProcessor.py

* add unit test for raise exception on auto assessment systemd

* refactor python file
2024-09-19 15:16:03 -07:00
Rajasi Rane c01c7bc871
Updating extension version to 1.6.55 (#261) 2024-06-19 08:52:08 -07:00
Rajasi Rane 872702a8b0
Refreshing cache with machine source prior to ending execution (#260)
* Refreshing cache with machine source prior to ending execution

* Refreshing cache with machine source: Addressing PR feedback #1

* Refreshing cache with machine source: Addressing PR feedback #2
2024-06-18 15:42:31 -07:00
feng-j678 e13b5517ca
update version to 1.6.54 (#259) 2024-05-03 12:42:21 -07:00
GAURAVRAMRAKHYANI 16417064df
Calculate maximum batch size in batch patching as per time remaining in maintenance window (#250)
* Increasing batch size from 3 to 6

* Added function signatures and callers from the code

* Some indentation changes

* Incorporate PR comments

* Implemented the function get_max_batch_size
fixed some issues in code after manual testing.
Updated the average time to install package in different package managers based on update in kusto query to get average time.

* Addressing some comments in the PR. The comments addressed are:
(a) There should be two new lines at the end of file
(b) Extract some code of install_updates to another function as install_updates was getting longer.

* Added test case for get_max_batch_size

* Addressed PR comments

* added package_manager in the callers for the method is_package_install_time_available in test code

* Removed mentioning specific package manager in test_get_max_batch_size

* Add runtime.stop() at the end of the test test_get_max_batch_size

* Addressing PR comments and one fix.

The fix is in the function get_max_batch_size, there is difference in behaviour in python2 and python3. In python2, int/int is int but in python3 int/int is float

Addressed PR comment by adding the class PackageBatchConfig for batch patching constants

* Update unit tests to increase code coverage

* Update test cases as per the product code changes done.

* update test case to increase % coverage

---------

Co-authored-by: Koshy John <kjohn@microsoft.com>
2024-05-03 11:29:05 -07:00
Koshy John b8d7a16487 Update ci.yml 2024-05-01 14:34:02 -07:00
feng-j678 8d8c33599f
update extension to 1.6.53 (#255) 2024-04-01 14:30:06 -07:00
Koshy John 2112b98511
Hotfix changes for strict SDP having some updates show up as 'new' packages (#254) 2024-03-28 16:46:12 -07:00
feng-j678 571950c67b
Update extension to v1.6.52 (#253)
Hotfix
2024-03-27 15:47:02 -07:00
Koshy John 9502155d22
Root-causing package caching as a source of failure (#252) 2024-03-27 15:31:41 -07:00
feng-j678 c58b9aaf33
add more unit test in status handler to increase code coverage (#226)
* add more unit test in status handler to increase code coverage

* pull master changes and add sequence numb termination utest to status_handler

* ignore scratch folder/content

* remove duplicate assertion

* rename Test sequence number change for installation ut

* remove scratch from gitignore

---------

Co-authored-by: Koshy John <kjohn@microsoft.com>
2024-03-20 15:43:48 -07:00
GAURAVRAMRAKHYANI 873457219d
Fix the issue that if there are conflicting packages in the yum install command then installation of all the packages in the command fails. (#248)
* Fixes two issues:
(a) If there are two conflicting packages in install command then installation of all the packages in the command fails. Added --skip-broken to ignore one of the conflicting packages and install rest of the packages.
(b) Install packages fails due to conflicting request in yum when there are two packages with same name but different arch and different versions.

* Fixed test failures
2024-03-08 13:37:40 +05:30
feng-j678 a52fe4be9a
update extension version to 1.6.51 (#246) 2024-02-28 15:04:01 -08:00
feng-j678 38bbf82444
Pr1.3/truncation conditonal checker (#242)
* initial commit

* add test comment to remove changes in truncation pr

* reset Test_statushandler.py

* add public getter methods for truncated removed patches and update __expected_truncated_patch_count

* change test_truncation_method_time_performance max to 35 sec

* comment out the test_truncation_method_time_performance ut

* change time performance to 70 sec

* add assertion for error message

* add error assertion

* comment out the installation debug to see if tests are failing or not

* revert changes add debug for pipeline

* change time performance to 90 sec

* change time performance to 30 sec

* use github env instead of github output

* add unit test ouput to github env

* combine Read test output and check if all tests passed and use bash shell

* remove print

* remove expected_truncated_count, and update uttest assertion for expected count

* add tombstone logic

* reduce iteration to 30 in performance test

* remove pacakge setup to outside for loop, it is not suppose to be inside

* update the method description

* uncomment the debug in set_install_packages

* add tombstone logic and ut

* add assertion for tombstone

* reduce performance time from n2 to n

* add one more ut for keep 5 assessment

* cm1 add condition logic set up code

* add condition tracker and fix ut

* add logic to reset is_status_file_truncated

* change logic for force_truncation_on

* add log for IsTruncationAllowed and IsForceTruncation

* add new time performance config file and add logic for not modifying status during transitioning

* refactor assessment tombstone method

* remove enum object and add space to eof

* add space to eof

* fix the logic to ensure trucation is applied all time when file > 126kb

* remove unused log_verbose

* cm2 add logic to check status for transitioning and not to update status and error msg

* modify code to add log and check for terminal state

* add logic for adding error msg and status change

* reformat the logic for recompose message errors json

* add test for informational message

* refactor test_packages to test_patches

* cm1 remove unnecessary log and change test_packages to test_patches

* add tombstone description to information ut

* refactor set_errors_msg to compose_errors_msg

* refactor errors_message to error_detail

* split set_status_file into assessment and instllation

* refactor assessment tombstone methods

* remove todo for installation tombstone

* refactor write_assessment/installation_status_file and use orderdict instead of map to kep order of tombstone for py27

* reduce patch_count size

* refactor _set_force_truncation_on_terminal_status

* add space so push -f can resolve codecov report upload failure

* remove tracker from truncation_timestamp

* modify No_truncation_logic_in_sec to Delay_truncation_by_sec and combine the if logic when truncation is going to apply

* use MIN_TRUNCATION_INTERVAL_IN_SEC, and refactor __get_status_payload_with_truncated_patches returns

* cm2 add datetime logic test truncation iteration

* use event.wait to pause ut to get different last modified time

* reorder imports in test_truncation

* set EPOCH as constant

* use reflection to set truncation_timestamp
2024-02-28 14:38:18 -08:00
Rajasi Rane 2faa8ad2ee
Bug fix: Auto assessment attempting to update healthstore (#244)
* Bug fix: Auto assessment attempting to update healthstore

* Bug fix: Auto assessment attempting to update healthstore: Adding UTs

* Minor fixes
2024-02-27 15:11:09 -08:00
feng-j678 9481da652a
Pr1.2/add tombstone (#241)
* initial commit

* add test comment to remove changes in truncation pr

* reset Test_statushandler.py

* add public getter methods for truncated removed patches and update __expected_truncated_patch_count

* change test_truncation_method_time_performance max to 35 sec

* comment out the test_truncation_method_time_performance ut

* change time performance to 70 sec

* add assertion for error message

* add error assertion

* comment out the installation debug to see if tests are failing or not

* revert changes add debug for pipeline

* change time performance to 90 sec

* change time performance to 30 sec

* use github env instead of github output

* add unit test ouput to github env

* combine Read test output and check if all tests passed and use bash shell

* remove print

* remove expected_truncated_count, and update uttest assertion for expected count

* add tombstone logic

* reduce iteration to 30 in performance test

* remove pacakge setup to outside for loop, it is not suppose to be inside

* update the method description

* uncomment the debug in set_install_packages

* add tombstone logic and ut

* add assertion for tombstone

* reduce performance time from n2 to n

* add one more ut for keep 5 assessment

* add new time performance config file and add logic for not modifying status during transitioning

* refactor assessment tombstone method

* remove enum object and add space to eof

* add space to eof

* add logic for adding error msg and status change

* reformat the logic for recompose message errors json

* add test for informational message

* refactor test_packages to test_patches

* add tombstone description to information ut

* refactor set_errors_msg to compose_errors_msg

* refactor errors_message to error_detail

* split set_status_file into assessment and instllation

* refactor assessment tombstone methods

* remove todo for installation tombstone

* refactor write_assessment/installation_status_file and use orderdict instead of map to kep order of tombstone for py27

* reduce patch_count size
2024-02-26 10:20:21 -08:00
feng-j678 b3eda2e68c
reduce patches to 10000 to improve ut time performance (#243) 2024-02-22 16:16:27 -08:00
feng-j678 4c6b99f0cd
Pr1.1/reduce status file error (#222)
* initial commit

* add test comment to remove changes in truncation pr

* reset Test_statushandler.py

* add public getter methods for truncated removed patches and update __expected_truncated_patch_count

* change test_truncation_method_time_performance max to 35 sec

* comment out the test_truncation_method_time_performance ut

* change time performance to 70 sec

* add assertion for error message

* add error assertion

* comment out the installation debug to see if tests are failing or not

* revert changes add debug for pipeline

* change time performance to 90 sec

* change time performance to 30 sec

* use github env instead of github output

* add unit test ouput to github env

* combine Read test output and check if all tests passed and use bash shell

* remove print

* remove expected_truncated_count, and update uttest assertion for expected count

* reduce iteration to 30 in performance test

* remove pacakge setup to outside for loop, it is not suppose to be inside

* update the method description

* uncomment the debug in set_install_packages

* add new time performance config file and add logic for not modifying status during transitioning

* remove enum object and add space to eof

* add logic for adding error msg and status change

* reformat the logic for recompose message errors json

* add test for informational message
2024-02-21 16:09:49 -08:00
feng-j678 5b37e9fc77
combine Read test output and check if all tests passed and use bash shell (#240) 2024-02-06 13:54:21 -08:00
feng-j678 357ab4cf17
Pr1/reduce status file (#218)
* revert statushandler test and core main

* add space for runtime

* add description to tests

* cm1 add method descriptions in coremain truncation tests

* cm2 refactor statushandler truncation error

* cm1 remove irrelevant utests

* cm3 remove comments in handler, and extract asserts all msg fields

* add assertion to test all fields in msg json

* add log for packages truncation

* refactor the testCoreMaintruncation into statushandlertruncation

* add 1 extra to eof in status handler truncation.py

* refactoring

* refactor 2

* change truncation time performance to 30sec

* refactor imports

* cm1 refactor packages to patches

* cm2 refactor var and methods name to use patches

* reassign patches_removed_from assessment/installation to class var

* just refactoring

* refactoring 2

* refactor 3

* add remove test comment

* adding stuff here

* refactor 4

* refactor __assert_patch_summary_from_status

* refactor all unit tests logic into __assert_patch_summary_from_status

* refactor method description

* refactor tmp file log logic

* correct the error code

* add expected_truncated_patch_count for assertion

* modify the ut test description

* update __assert_patch_summary_from_status assertio to set status file <= internal agent limit

* format truncation unit test

* add public mthod for accesing private truncation var

* # -*- coding: utf-8 -*- to top of file to ensure py27 recognized euro symobl as ASCII char

* cm1 refactor with method into a function

* cm2 refactor asserting truncation variables

* assessment utest are failing

* fix assessment utest by declaring classification

* cm3 refactor status file setup into a class func

* address pr comments

* chnage log_debug to log_verbos, ignore scratch folder (not needed)

* exlcude unittest.main from code coverage

* revert changes in gitignore but exclude unnitest.test()

* remove prag no cover since it doesn't work with codecov
2024-02-02 12:10:13 -08:00
feng-j678 2b8bf08631
updating extension to 1.6.50 (#236)
* updating extension to 1.6.50

* change constant to .49 to perform a force push for codecov

* change version to 1.6.50

* use latest action version to address codecov issue

* add extra to eof in ci.yml to match with master
2024-01-31 11:51:20 -08:00
feng-j678 dedb1b4ff3
use nodejs20 instead of 16 (#237)
* set job to use nodejs20

* use v3 instead v4

* use v2 instead v3 for nodejs20

* update action to version that support nodejs20

* remove the job that install nodejs20
2024-01-31 10:36:20 -08:00
Arun Sathiya c0117beacb
ci: Use GITHUB_OUTPUT envvar instead of set-output command (#232)
Co-authored-by: Koshy John <kjohn@microsoft.com>
2024-01-30 12:50:39 -08:00
feng-j678 b98b63c516
add encoding propertity to resolve pro-client prerequist error (#233) 2024-01-26 15:15:21 -08:00
feng-j678 dfd4909493
address telemetry message truncation bug - bad unicode error (#228)
* add bad char for unit test

* address bad unicode truncation and add unit test

* revert space in __ensure_message_restriction_compliance
2024-01-04 10:30:14 -08:00
GAURAVRAMRAKHYANI 83961b0c4b
Increasing batch size from 3 to 6 to improve performance of batch patching (#227)
* Increasing batch size from 3 to 6

* Updated unit tests for increasing batch size from 3 to 6

* Moved NUMBER_OF_PACKAGES_IN_BATCH_COULD_TAKE_MAX_TIME_TO_INSTALL to Constants file

* Add inline comments for PACKAGE_INSTALL_EXPECTED_AVG_TIME_IN_MINUTES
2023-11-30 15:20:19 +05:30
Koshy John 52b934a1b6
Linux Patch Extension Release 1.6.49 (#225) 2023-10-31 16:56:15 -07:00
Koshy John 7d90cffced
Reduced set: Safe-deployment enhancements (#223)
* Reduced set - safe-deployment enhancements

* Informational message requested added.

* Increased test coverage

* Test coverage and retry exhaustion throw

* Minor comments
2023-10-31 16:53:45 -07:00
GAURAVRAMRAKHYANI b50ef629ba
Extend Composite Logger log functions to have built in buffer (#213)
* Composite logger log functions can be extended to have built in buffers

* Moving logic for buffer message in TelemetryWriter

* Add unit tests for write_event_with_buffer

* Simplifed the case of Flush. the case event_level != self.last_telemetry_event_level is already handled and hence should not come in flush case.

* Add test case for code coverage
2023-09-28 11:13:19 -07:00
GAURAVRAMRAKHYANI 37d1596d40
Obsolete packages should not be attempted to install (#212)
* Obsolete packages should not be attempted to install

* Remove non required changes from test code.

* Using strip() to remove leading and trailing spaces

---------

Co-authored-by: Koshy John <kjohn@microsoft.com>
2023-09-19 14:30:05 -07:00
Rajasi Rane 5d83323ba7
Updating extension version to 1.6.48 for a new release (#217) 2023-09-15 12:11:51 -07:00
Rajasi Rane c999295591
Adding EULA acceptance based on an inVM approval mechanism (#215)
* Adding EULA acceptance based on an inVM approval machanism

* Adding EULA acceptance: UTs and some  minor changes

* Adding EULA acceptance: code changes and more UTs

* Adding EULA acceptance: Addressing PR feedback #1

* Adding EULA acceptance: Adding unit tests on recent code change

* Adding EULA acceptance: Addressing PR feedback #2

* Adding EULA acceptance: code cleanup

* Adding EULA acceptance: adding more logs

* Adding EULA acceptance: Addressing PR feedback #3

* Adding EULA acceptance: Fixing UTs

* Adding EULA acceptance: Accepting boolean values in different formats
2023-09-14 15:50:26 -07:00
Rajasi Rane bd81687be9
APT: Patch Mode set to disabled in ConfigurePatching when os patch config file does not exist (#216)
* APT: Patch Mode set to disabled in ConfigurePatching when os patch config file does not exist

* APT: Patch Mode set to disabled in ConfigurePatching: Fixing failing unit tests

* APT: Patch Mode set to disabled in ConfigurePatching: Trying a fix for codecov failure

* APT: Patch Mode set to disabled in ConfigurePatching: resolving duplicate UT names
2023-09-14 10:29:11 -07:00
feng-j678 3d68c37e72
User/jf/remove old complete status file (#205)
* add remove older complete status file logic and refactor json.loads(message)

* change write_complete_status_file() to write_status_file()

* change __removed_older_complete_status_files() list to be files_to_be_removed

* remove unnecessary imports in coremain

* modify logic to keep min 10  and remove oldest complete status files

* use constants for complete status file count

* fix test case to use os.path.join

* commit 2 reorder sort to under base case

* remove print

* commit 1 change constant, and add unit test for exception

* add raise exception to check test_if_complete_and_status_path_is_dir

* modify the test for test_if_complete_and_status_path_is_dir

* add reset to status path

* commit -3 modify the test_remove_old_complete_status_files to make sure 1.complete.status has highest getmtim()

* commit 1 refactor code

* add extra line in status_handler.py
2023-08-21 08:00:26 -07:00
GAURAVRAMRAKHYANI dae984ae89
For yum package manager only, sometimes VM gets rebooted in install updates job even though reboot is not required (#210) 2023-07-27 20:42:39 +05:30
feng-j678 4fa74fa901
raise exception if min py version is < 2.7 (#207)
* raise excetion if min is < 2.7

* change log_debug to log_error

* add min_python_version exception to start_assessment()

* reset python version after unit test is completed

* changing python version description and revert changes in bootstrapper.py

* add conditio for python version is not met in installation logic

* revert changes in test_coremain.py
2023-07-17 16:18:32 -07:00
Rajasi Rane 05fb0aad28
Adding more sources to security sources list (#208)
* Adding more sources to security sources list

* removed commented code
2023-07-16 22:00:32 -07:00
SathishMSFT f3b7c7bf5f
telemetry change to get esm packages selected count (#202)
Telemetry change to get esm packages selected count
2023-07-12 09:43:33 +05:30
feng-j678 dc0a735d9d
Fix NameError: name 'OrderedDict' is not defined during runtime (#204)
Co-authored-by: Koshy John <kjohn@microsoft.com>
2023-07-06 15:08:21 -07:00
feng-j678 c5583354f0
User/jf/add complete status file logic (#195)
* add complete status file logic, and modify every status file points to complete status file

* add constants, and unit test to status handler

* add unit test for tesitng complete_status path is dir and log

* modify constant truncation warning msg, and reset_status_file()

* revert status_file to complete_status_file

* remove changes in constants, and update tests

* remove unnecessary truncation unit tests

* format code to add extra line and spaces, and change [IncludeAssessmentWithConfigurePatching={3}]

* remove status_handler object reference

* add more verifications to test_if_status_file_resets_on_load_if_malformed

* force push

---------

Co-authored-by: Koshy John <kjohn@microsoft.com>
2023-07-06 15:01:08 -07:00
Koshy John b7d220377d
Setting auto assessment service to type: forking (#203)
* Setting auto assessment service to type: forking

* Force push with trivial message
2023-07-06 11:57:14 -07:00