-
Notifications
You must be signed in to change notification settings - Fork 179
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
Added ip_power control for BareMetal platform #3550
base: main
Are you sure you want to change the base?
Conversation
Please rebase on latest main to avoid conflict. |
from .schema import IPPowerSchema | ||
|
||
|
||
class IPPower(subclasses.BaseClassWithRunbookMixin, ContextMixin, InitializableMixin): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Inherit from features.StartStop.
- Move it under
cluster/generic
.
@dataclass | ||
class IPPowerSchema(schema.TypedSchema, schema.ExtendableSchemaMixin): | ||
type: str = field(default="Ip9285", metadata=field_metadata(required=True)) | ||
hostname: str = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
host
class Ip9285(IPPower): | ||
def __init__(self, runbook: IPPowerSchema) -> None: | ||
super().__init__(runbook) | ||
self._request_cmd = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does the P6
mean? If it's part of the port
, move it to on/off, so it's clearer.
def type_schema(cls) -> Type[schema.TypedSchema]: | ||
return IPPowerSchema | ||
|
||
def on(self, port: int) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change the type of port to str
, because maybe other type uses a name instead of an int.
|
||
def on(self, port: int) -> None: | ||
request_on = f"{self._request_cmd}{port}=1" | ||
requests.get(request_on) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow the internal example to check the status, make sure it's reliable.
Co-authored-by: paull <[email protected]>
…to paull/ippower
# This is the 1st commit message: Added ip_power control for BareMetal platform # The commit message microsoft#2 will be skipped: # Added tftp deployment on BareMetal platform (microsoft#3422) # # Co-authored-by: paull <[email protected]>
…to paull/ippower
3e96684
to
43ecb77
Compare
No description provided.