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

Open URL through automate for various objects #380

Merged
merged 1 commit into from
Jul 1, 2019

Conversation

martinpovolny
Copy link
Member

@martinpovolny martinpovolny commented Jun 11, 2019

@miq-bot
Copy link
Member

miq-bot commented Jun 11, 2019

Checked commit martinpovolny@8512e5a with ruby 2.3.3, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0
1 file checked, 1 offense detected

db/migrate/20160309144534_create_system_consoles.rb

@martinpovolny martinpovolny force-pushed the automate_url_open branch 2 times, most recently from 8d2a70f to 01f4348 Compare June 25, 2019 08:34
@martinpovolny martinpovolny changed the title [WIP] Open URL through automate for various objects Open URL through automate for various objects Jun 25, 2019
@martinpovolny
Copy link
Member Author

ping @Ladas

def change
create_table :saved_urls do |t|
t.bigint "refers_to_id", :type => :bigint
t.string "refers_to_type"
Copy link
Contributor

@Ladas Ladas Jun 25, 2019

Choose a reason for hiding this comment

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

t.references :refers_to, :polymorphic => true, :index => true, :type => :bigint

should create the refers_to_id and ..._type` and the index

@@ -0,0 +1,12 @@
class CreateSavedUrls < ActiveRecord::Migration[5.0]
def change
create_table :saved_urls do |t|
Copy link
Contributor

Choose a reason for hiding this comment

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

should be create_table :saved_urls, :id => :bigserial I believe

@Ladas
Copy link
Contributor

Ladas commented Jun 25, 2019

cc @lpichler what's the rake command to generate the schema? We should still run it, right? (The CI was failing without it in the past)

@martinpovolny
Copy link
Member Author

@Ladas : PR updated according to your guidance. Please, check again.

class CreateExternalUrls < ActiveRecord::Migration[5.0]
def change
create_table :external_urls, :id => :bigserial do |t|
t.references :refers_to, :polymorphic => true, :index => true, :type => :bigint
Copy link
Contributor

Choose a reason for hiding this comment

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

if the index => true here does't work, lets remove it (it should create external_urls for you, but it's not implemented in all migration methods)

Copy link
Contributor

Choose a reason for hiding this comment

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

refers_to maybe just resource ?

def change
create_table :external_urls, :id => :bigserial do |t|
t.references :refers_to, :polymorphic => true, :index => true, :type => :bigint
t.string "url"
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: but we are using symbols:

t.string "url"

Copy link
Member

Choose a reason for hiding this comment

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

Agree with @lpichler here, can we use all symbols for the column names?

Copy link
Member Author

Choose a reason for hiding this comment

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

I missed that. Fixed now.

t.belongs_to :user, :type => :bigint
end

add_index "external_urls", ["refers_to_id", "refers_to_type"], :name => "saved_urls_on_refers_to_id_and_refers_to_type"
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

@lpichler
Copy link
Contributor

lpichler commented Jul 1, 2019

cc @lpichler what's the rake command to generate the schema? We should still run it, right? (The CI was failing without it in the past)

looks like it was removed: http://talk.manageiq.org/t/new-schema-specs-for-new-replication/1404/4

@martinpovolny
Copy link
Member Author

@Ladas : fixed.

@lpichler : renamed and also renamed in the core PR here: ManageIQ/manageiq#18849

@lpichler
Copy link
Contributor

lpichler commented Jul 1, 2019

@miq-bot assign @carbonin

@carbonin
Copy link
Member

carbonin commented Jul 1, 2019

@martinpovolny I think the BZ link should be https://bugzilla.redhat.com/show_bug.cgi?id=1643331, right?

The one in the initial PR comment is closed.
Also could you add it to the commit message so the bot will pick it up and comment on the BZ?

@carbonin
Copy link
Member

carbonin commented Jul 1, 2019

Also, what objects are going to be referenced by this url and if it's temporary, why do we need a table?

@agrare
Copy link
Member

agrare commented Jul 1, 2019

@martinpovolny If the goal is to show the vm summary page why a new table and not an attribute on the vm like we do with topology?

Also, the URL for vsphere is going to be different depending on version, if you have the html5 UI or just the old flash UI, etc... so I'm curious who would be generating this URL.

E.g. for vSphere 6.7 it looks like this https://dev-vc67/ui/#?extensionId=vsphere.core.inventory.serverObjectViewsExtension&objectId=urn:vmomi:VirtualMachine:vm-337:a6b3087a-3d6b-4852-9732-17094d702269&navigator=vsphere.core.viTree.vmsAndTemplatesView so I'm curious who would be generating this URL as it is highly provider dependent

@martinpovolny
Copy link
Member Author

martinpovolny commented Jul 1, 2019

@carbonin : the link is correct.

@martinpovolny If the goal is to show the vm summary page why a new table and not an attribute on the vm like we do with topology?

No that is not the goal. The goal is in the BZ. If the goal is not clear from the BZ, then, please, read the (partial) documentation in this PR: ManageIQ/guides#355

This PR has nothing to do with the VM consoles although it can be used to replace a VM console with a custom one.

@martinpovolny
Copy link
Member Author

Also, what objects are going to be referenced by this url and if it's temporary, why do we need a table?

How else do we pass data from a worker running on one appliance to a different appliance?

@agrare
Copy link
Member

agrare commented Jul 1, 2019

The bz you have linked to in the description is closed as a duplicate of https://bugzilla.redhat.com/show_bug.cgi?id=1643331

The goal of the BZ is pretty clear:

Description of request:

Ability to create CloudForms custom buttons which can open an HTTPS URL to a provider's web client.

Also important that this also isn't the VM's console, but the VM's summary page.

@martinpovolny
Copy link
Member Author

@NickLaMuro, @agrare: this is about extending an existing mechanism (mentioned for example here:
http://talk.manageiq.org/t/lauch-ssh-error/4343/15 ) to work with several new types of entities.

I have implemented that mechanism several years ago, and at that time I did put the URL in the SystemConsole table. That limits the usefulnes of that to just VMs.

Here I am trying to do the same in a more universal way.

I do not know how else to explain it to you. Above I have linked a PR to a guides PR where the mechanism is explained: https://github.com/martinpovolny/guides/blob/automate_url_opener/automate_url_open.md.

Do you need any further explanation? Shall we schedule a video chat?

@NickLaMuro
Copy link
Member

@martinpovolny Wrong "Nick" I think...

cc @carbonin

@martinpovolny
Copy link
Member Author

The bz you have linked to in the description is closed as a duplicate of > https://bugzilla.redhat.com/show_bug.cgi?id=1643331

I have linked the one that contains a better explanation of the issue. On purpose.

You are linking the one that only mentiones one usecase and very shortly. Please, read the BZ that I linked.

@agrare
Copy link
Member

agrare commented Jul 1, 2019

Okay sounds like this bz https://bugzilla.redhat.com/show_bug.cgi?id=1643331 should have actually been marked as a duplicate of https://bugzilla.redhat.com/show_bug.cgi?id=1550002 then? We shouldn't be pointing PRs to closed BZs so lets either reopen the original one or add enough description to the current BZ.

@martinpovolny
Copy link
Member Author

I am glad we moved forward ;-)

Are there any changes needed here on top of what @Ladas and @lpichler requested (and I already did)?

@carbonin carbonin merged commit 339c7fb into ManageIQ:master Jul 1, 2019
@carbonin carbonin added this to the Sprint 115 Ending Jul 8, 2019 milestone Jul 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants