Skip to content

[sonic-package-manager] implement blocking feature state change#38

Closed
stepanblyschak wants to merge 4 commits intomasterfrom
block-feature
Closed

[sonic-package-manager] implement blocking feature state change#38
stepanblyschak wants to merge 4 commits intomasterfrom
block-feature

Conversation

@stepanblyschak
Copy link
Copy Markdown
Owner

Signed-off-by: Stepan Blyschak stepanb@nvidia.com

What I did

Implement blocking feature state change for CLI command and sonic-package-manager.

How I did it

Implemented a wait loop that blocks till feature reaches desired state.

How to verify it

Run UT, run on switch.

Previous command output (if the output of a command-line utility has changed)

New command output (if the output of a command-line utility has changed)

Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
Comment on lines +33 to +38
db = swsscommon.DBConnector('STATE_DB', 0)
tbl = swsscommon.SubscriberStateTable(db, 'FEATURE')
sel = swsscommon.Select()

sel.addSelectable(tbl);

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

move outside of while block to run this code only once.

run_command(f'systemctl {action} {name}@{npu}')
feature_name = package.manifest['service']['name']
log.info('{} {}'.format(state.replace('ed', 'ing').capitalize(), feature_name))
set_feature_state(Db(), feature_name, state, block)
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Db() make member object.

service_creator,
device_info,
filelock.FileLock(PACKAGE_MANAGER_LOCK_FILE, timeout=0))

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

check if not reduntand new line

Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
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